Skip to content
Filter

Type at least two letters.

Search that lives in your browser

Press / anywhere and search every post and series. There is no search server and no search history.

Dev
· 2 min read
DraftedFeaturesNote

Drafted has search, and it needs no server to run.

How to Use It

Press / on any page, or click the search box in the header. A panel opens with the cursor already in the box. Type a few letters and results appear as you go, each with the matching words highlighted in a short excerpt.

  • Arrow keys move through the results, and Enter opens one.
  • Esc closes the panel.
  • The / key is ignored while you are typing in a box, so it never gets in the way.

You can narrow the results with the buttons under the box: posts or series, and the most common topics.

Where the Index Comes From

A search needs an index: a compact list of words and where they appear. Most sites ask a server to look words up in a database for every search.

Drafted builds the index once, when the site is built, from the finished pages. The index is a set of small files that sit next to the posts.

A search server
Every query is sent somewhere, handled by code that has to be running, and paid for.
An index made at build time
Files served like any other. Your browser fetches only the pieces it needs and searches them itself.

What That Means for You

  • There is no search server and no search history. Your browser downloads small pieces of the index and does the matching itself, so there is no program receiving your queries.
  • It costs almost nothing to run. The index is files, and files are what the site already serves.
  • It loads only when you ask. The search code is not downloaded until the first time you open the panel, so reading a post stays light.
  • It is always in step with the site. Every deploy rebuilds the index from the pages that went live.

What It Does Not Do

Search covers posts and series, not the sign-in pages or your private messages. Those are kept out of the index on purpose.

It also works only on the built site. If you are running the site locally in development mode, there is no index yet, so the panel will say that search is unavailable.

Search is a set of files, and your browser does the looking.

Comments

Private

Only you and the author can see what you write here. The author replies, and you can answer back.