Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 807
Lars Avatar asked Dec 07 '25 06:12

Lars


1 Answers

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

gem install json
gem install nokogiri
like image 58
Lars Avatar answered Dec 08 '25 21:12

Lars



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!