3

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?

David Laberge
  • 15,435
  • 14
  • 53
  • 83
Lars
  • 7,908
  • 11
  • 52
  • 70

1 Answers1

1

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

gem install json
gem install nokogiri
Lars
  • 7,908
  • 11
  • 52
  • 70
  • I'm afraid you'll have to find a workaround as plugins are not supported by github pages, I am using lunr with jekyll by following the process from [this page](http://jekyll.tips/jekyll-casts/jekyll-search-using-lunr-js/). You can of course then modify this to get the data from a json file that you'll create with liquid code. – Miloš Miljković Oct 09 '16 at 20:49