How to add a search bar?

How we can add a search bar in Jekyll website.


See these tutorials on search from CloudCannon:


Here is an example of a super simple site-search (using Google):

<form method="get" action="" target="_blank">
<input type="hidden" name="sitesearch" value="" />
<input type="text" name="q" maxlength="255" placeholder="Search with Google" />

Note that the domainname needs to be changed (currently ‘’). See the full code at: The live website can be found here:

You can use a Javascript search like lunr.

1 Like

i have made a search feature for a Jekyll shop. using this method shown here

So, if we add the search bar on what basis it will show the search results?

On the basis of category or tags or keyword?

On build it will build an xml file to search… I used a bit of ymal call search terms

I have tried to add the search bar. But it didn’t go well.

Is there any other option?

Have you looked into Algolia?

There’s a Jekyll plugin to auto-sync data from a standard Jekyll blog (link).

If you’re doing more than a blog, a quick search on Github will pull up a number of results (including a few I’ve made over the years). I’d recommend starting with their instantsearch library.

1 Like

Algolia it is quite expensive.

1 Like

They have a free tier for open source projects.


Currently I have 380 blog posts on my website.

When I run the command jekyll algolia, it upload all the data to Algolia website and turn out, it filled 8100 queries from 10000.

Which is not a good?

1 Like

So, I use Lunr.js and it worked perfectly, free and open source project.


I have over 1000 posts on my site and haven’t max’d out any of the free tier.

Lunr is fine. Algolia in my experience does a better job and is more performant.


How did you do that?

1 Like

I’m not doing anything special, just jekyll algolia same as you.

I’m using 2,790 / 10,000 records and about 525 search queries in the last 24 hours. My understanding is the records are tied to the posts and their data. Add more posts and that goes up.

Queries depend on how active your site is and the amount of searches performed.

Your records seem pretty high for having a fourth of the posts I have. Maybe login to your Algolia dashboard and check the indices.

1 Like

Yeah, it is 8375 records.

Here’s the records


Here’s the indices


1 Like

Seems a bit high to me. What exactly is it indexing? Do you have a lot of attributes?

For reference I have a ton of posts and are no where close to hitting 10,000.

Looks like for me it’s indexing about 10 attributes per post (title, content, tags, type, date, excerpt, slug, url, etc.) on my site.

Maybe you could leave an issue on the Algolia plugin’s GH to inquire how to reduce the records indexed.

1 Like




1 Like

There’s your issue. Didn’t you say you had less than 400 posts? According to what Algolia is indexing you have over 8,000.

Explains why you’re almost at 10,000 records.

1 Like