Skip to content
A JavaScript library to add search functionality to any Jekyll blog.
JavaScript CSS HTML Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
cypress add integration test for support of query in url Dec 11, 2018
dest add integration test for support of query in url Dec 11, 2018
example add integration test for support of query in url Dec 11, 2018
scripts Switch to xo. Dec 15, 2017
src interpolate {query} in template Dec 11, 2018
tests interpolate {query} in template Dec 11, 2018
.gitignore nothing Oct 21, 2018
.travis.yml travis node 9 Dec 10, 2018 add cypress docs Mar 20, 2018 added copyright notice Aug 10, 2015 improve readme Nov 3, 2018 add wiki, move options to wiki Mar 20, 2018
cypress.json add first cypress test Mar 20, 2018
index.html moved jekyll to sub dir Oct 4, 2015
package-lock.json 1.7.2 Dec 11, 2018


Build Status dependencies Status devDependencies Status

A JavaScript library to add search functionality to any Jekyll blog.

🚀 Read this guide 📖 to get started!

Use case

You have a blog, built with Jekyll, and want a lightweight search functionality on your blog, purely client-side?

No server configurations or databases to maintain.

Just 5 minutes to have a fully working searchable blog.



npm install simple-jekyll-search

Getting started

Create search.json

Place the following code in a file called search.json in the root of your Jekyll blog. (You can also get a copy from here)

This file will be used as a small data source to perform the searches on the client side:

layout: null
  {% for post in site.posts %}
      "title"    : "{{ post.title | escape }}",
      "category" : "{{ post.category }}",
      "tags"     : "{{ post.tags | join: ', ' }}",
      "url"      : "{{ site.baseurl }}{{ post.url }}",
      "date"     : "{{ }}"
    } {% unless forloop.last %},{% endunless %}
  {% endfor %}

Preparing the plugin

Add DOM elements

SimpleJekyllSearch needs two DOM elements to work:

  • a search input field
  • a result container to display the results

Give me the code

Here is the code you can use with the default configuration:

You need to place the following code within the layout where you want the search to appear. (See the configuration section below to customize it)

For example in _layouts/default.html:

<!-- HTML elements for search -->
<input type="text" id="search-input" placeholder="Search blog posts..">
<ul id="results-container"></ul>

<!-- script pointing to jekyll-search.js -->
<script src="{{ site.baseurl }}/simple-jekyll-search.min.js"></script>

<!-- or -->
<script src=""></script>


Customize SimpleJekyllSearch by passing in your configuration options:

var sjs = SimpleJekyllSearch({
  searchInput: document.getElementById('search-input'),
  resultsContainer: document.getElementById('results-container'),
  json: '/search.json'

returns { search }

A new instance of SimpleJekyllSearch returns an object, with the only property search.

search is a function used to simulate a user input and display the matching results. 


var sjs = SimpleJekyllSearch({ ...options })'Hello')

💡 it can be used to filter posts by tags or categories!


Check out the wiki for the options!


Check out the wiki for general discussions.


  • npm install
  • npm test

Acceptance tests

cd example; jekyll serve

# in another tab

npm run cypress -- run


Thanks to all contributors over the years! You are the best :)

@daviddarnes @XhmikosR @PeterDaveHello @mikeybeck @egladman @midzer @eduardoboucas @kremalicious @tibotiber and many others!

You can’t perform that action at this time.