5.8
Astronomic Search
What the free search plugin is, the Astro and EmDash paths, what you get, and where to begin.
Astronomic Search is free, typo-tolerant search for Astro and EmDash sites. It indexes your pages and their headings, and shows results in a search dialog. Search runs in the visitor’s browser, so there is no hosted search service to set up or pay for.
It ships on npm as @astronomic-dev/search, under the MIT license. One package holds both paths: an Astro integration and an EmDash plugin.
What you get
- A search dialog. It opens from a search button, or with Cmd+K (Ctrl+K on Windows and Linux) and
/. It loads only when a visitor reaches for search: on hover, focus, a click or a shortcut key. - Typo tolerance. “nortwind” still finds “Northwind rebrand”.
- Links to sections. On an Astro site, a match inside a section links straight to its heading.
- Type tabs and filters. Separate docs from articles, then narrow by a facet such as theme.
- A full results page. It keeps the visitor’s choices in a URL they can share.
- No JavaScript needed to get somewhere. The search button is a real link to your search page.
- Strict Content Security Policy friendly.
script-src 'self'; style-src 'self'works with no changes.
Pick your path
| Plain Astro | EmDash | |
|---|---|---|
| How you add it | An integration in astro.config.mjs |
A plugin in emdash({ plugins: [...] }) |
| Where the index comes from | Content collections, built HTML, or your own records | Your EmDash collections |
| When the index is built | At build time | On the server, about a minute after you publish |
| Where you change settings | In code | On the Search admin page |
| The theme’s own search box | You place the search button | Takeover can reuse the theme’s box |
| Heading links | Yes | Not yet (results link to the page) |
Your site serves every file itself. Nothing loads from us.
Where to start
- Install it: on plain Astro or on EmDash.
- Check that it works with your theme.
- Add the search results page.
All pages
- Install on Astro: the integration, sources, keywords and the search page.
- Install on EmDash: the plugin, the layout check, the admin page and Cloudflare.
- Works with your theme: shortcut keys, takeover, custom search boxes and how to check.
- The results page: the full page of results, for Astro and EmDash.
- Settings: every option and admin setting.
- Look and text: colors, parts, strings and keyboard.
- Analytics: the events search sends.
- Embed on any server: search on pages not built with Astro.
- Performance: size, caching and Content Security Policy.
- Troubleshooting: common problems and their fixes.
To try it first, see the live demo on the plugin page.