Use Simple-Jekyll-Search on your blog in these easy steps

Published on
Tagged with javascript58 jekyll4


  • a Jekyll blog (of course)

Create search.json

Create a file search.json with this content

Prepare HTML

In your template add the following markup to define a placeholder for the search widget:

<input type="text" id="search-input" placeholder="search posts..">
<div id="results-container"></div>

Initialize search widget

Add the following script tag to your base/default _layout:

<script src="[email protected]/dest/simple-jekyll-search.min.js"></script>

And in a separate script tag:

  searchInput: document.getElementById('search-input'),
  resultsContainer: document.getElementById('results-container'),
  json: '/search.json',
  searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
  noResultsText: 'No results found',
  limit: 10,
  fuzzy: false,
  exclude: ['Welcome']

That’s all!

Here, have a slice of pizza 🍕