wintersmith-search

wintersmith-search

A plugin to generate a search.json to be used with Simple-Jekyll-Search

wintersmith-search

A plugin to generate a search.json to be used with Simple-Jekyll-Search.

Requires wintersmith-contents

npm install wintersmith-contents --save
npm install wintersmith-search --save
  "plugins": [
    "wintersmith-contents",
    "wintersmith-search"
  ]

sample search page

extends layout

block append head
    script(src="https://unpkg.com/[email protected]/dest/simple-jekyll-search.min.js")
    script.
        document.addEventListener("DOMContentLoaded", function () {
        var sjs = SimpleJekyllSearch({
        searchInput: document.getElementById('searchInput'),
        resultsContainer: document.getElementById('resultsContainer'),
        json: '/search.json'
        });
        document.getElementById('searchInput').focus();
        });

block content
    .search
        h1 search
        input#searchInput(type='text', placeholder='Search blog posts..')
        ul#resultsContainer