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.
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
PrivateOnly you and the author can see what you write here. The author replies, and you can answer back.