jsonsearchjekylllunrjs

Jekyll search with Lunr JS, not working


I'm trying to implement search on my Jekyll site using Lunar JS with this plugin. https://github.com/slashdotdash/jekyll-lunr-js-search

I'm following the instructions in the readme but to a beginner they are not so clear.

I've followed everything up to step 5, ie added all the scripts to my template, and created a search box and container for my search results on the page I want to have search functionality.

However, step 6 says: "Create a Mustache template to display the search results." Where do I need to put this code? In a separate file? Or on the same page as I have my search box?

And step 7 requires me to add:

`indexUrl: '/search.json',  // URL of the `search.json` index data for your site`

Can somebody explain what this means? I know lunrjs is supposed to create a json file with all my blog data, but I can't find this json file anywhere. Am I doing something wrong?


Solution

  • You need to make sure that you have the json and nokogiri ruby gems installed. Type:

    gem install json
    gem install nokogiri