✨ Flair — a modern, stylish theme for your blogExplore

Ghost CMS News: Native Search

Ghost CMS native search function was introduced in version 5.3.0. It provides clean, fast and intuitive way fo find content across your publication

Norbert
Norbert3 min read

The Ghost team released one of the most requested features since the platform was launched: a built-in native search function. The search works with all Ghost themes, giving your readers easy access to search all published posts, tags, and authors on your site.

The official Ghost themes were updated and now include this new feature, but even if you are using a custom theme, you can easily add the feature to your site.

Adding the search function

As mentioned, if you are using your own theme, a customized official theme or a premium theme without the search function, you can still add the new native search.

There are two ways:

  1. Add the search with a link (#/search)
  2. Add the search with the data attribute (data-ghost-search)

The easiest way to start is using the link, for this you don't have to change the themes files. You can simply add a link in navigation pointing to the #/search. The label can be 'Search' or even an emoji (🔎).

The other way is using the data attribute, this means you have to edit the theme files, but the advantage is you can place the search trigger element wherever you want. You can add the attribute data-ghost-search to any element, but ideally it should be a button, for example:

<button class="search" data-ghost-search>{{> icons/search}}</button>

You can place this element in the header or in any other place you want, and when clicked it will open the search popup.

You can open the search UI directly by using the Ctrl/Cmd + K keyboard shortcut

Technical details & limitations

Taxonomies for tags and authors must be present for search results to include tags and authors.

There are a few limitations for the native search function:

  • the search feature does not index post content, the search is performed based on post titles, excerpts, authors and tags -to avoid performance issues, the search function can only index 10,000 posts (most recent posts)

For larger sites (more than 10,000 posts) it's recommended to use an advanced search functionality like Algolia.

Conclusions

The new native search is a great addition to the Ghost platform and although it's limited, there are plans to improve it in the next iterations. Overall it's an easy way to provide users the possibility to find what they're looking for with a single click.

If you are looking for alternatives check the post about Ghost search options.

More in News & Updates

All news

Biron Themes becomes Bright Themes 🎉

With Bright Themes, we're taking a bold step forward, infusing our themes with even more luminosity, and ensuring that your website shines brighter than ever before.

Ghost Pro Hosting

Get the best managed Ghost CMS hosting and focus on bringing value to your audience.