-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Site search #588
Comments
I've got it running on my site. Warning, it doubles the time it takes to generate a site. I was finishing in 20s, but now with Lunr it takes over 40s. |
@icicimov I don't have first-hand experience with Lunr but have used similar solutions. The instructions on that repo seem pretty good but if you need more of a "tutorial" there's quite a few if you search around.
I'll echo what @justinrummel said about build times. I haven't read Lunr docs to know if this is true but I would assume it works by querying a Other Jekyll search solutions I've used had you build a |
FYI; here are my commits for adding Lunr: |
@mmistakes and @justinrummel, thank you both for your help and useful tips. Pretty much following Justin's commit that he generously shared I have created the following structure: _config.dev.yml:
Gemfile: _plugins/ assets/js/lunr/ _includes/scripts.html _includes/search.html _pages/search.md:
but during the local site build the index.json file is not being created and I get ERROR `/blog/assets/js/lunr/index.json' not found. To me it looks like the plugin is not working for some reason. Do I need to do anything else apart from the above to get the plugin activated? Thanks again for your help, very much appreciated. |
Ok, seams I misinterpreted the plugin help page:
and thought the plugin will generate the assets/js/lunr/index.js file instead of the _sites/assets/js/lunr/index.json file ... doh. Still not working for some reason but after I dropped in a index.json file the plugin generated the index.json file ready for jquery to search but still blank. |
I've found Lunr to be very picky about the gem order. Please see my Gemfile and _config.yml and replicate. |
@justinrummel I have Lunr set up, it builds. I have tried to get your layout going with the Tag and Category archives, but I get build warnings: single layout doesn't exist. Then when visiting my site, I see the navigation but it says page not found, when I know for a fact I added those pages. I also don't have the hamburger menu for links that don't fit on the main page. Can you have a look at my repo? https://github.com/twhite96/twhite96.github.io Thank you. |
@twhite96 I think the issue is your JavaScript. If you fire up the console in your browser you'll see a bunch of errors. That's why the hamburger menu isn't working. |
@twhite96 the "single" is a layout https://github.com/twhite96/twhite96.github.io/blob/master/_layouts/single.html Not sure why it's not picking it up when it's obviously there in your repo. Only diff I can see between yours and mine is I have removed "{% include base_path %}" from the 5th line. In addition I use "compress" in my default layout. https://github.com/justinrummel/jr.com-mm/blob/jr-branch/_layouts/default.html |
@twhite96 Looking at your And you're using the theme-gem along with having all of the If you're using the theme gem then remove Or if you're not using the theme gem just remove |
Thanks @mmistakes and @justinrummel. I can't seem to get the search page running though. Says page not found. Everything else works after I fixed the js and deleted |
@mmistakes and @justinrummel seems that the tag archive and category archive works locally but only as a directory when running |
@twhite96 I was able to clone your repo locally and noticed you don't have the _pages section setup correctly. It should be files ending in .html will be converted to /filename/. Therefore, take a look at my _pages and use the same format while at the same time remove the .md files. WARNING, I've injected an element from @mmistakes hpstr to arrange all the tags at the top, then use CSS to display correctly... so your site may look different than mine. In addition, I updated your _config to state include:
- .htaccess
- _pages Tags, Categories, and Search display correctly now. Lastly, You did cleanup _includes as suggested when using the gem version of mm, however, you do need to keep the _includes/script.html as seen on my site as a gem override. Once that was in place, searched worked locally. |
Thank you @justinrummel! Got it working. |
Sadly I never got this working on my site :-( |
Here's my favorite Jekyll search experience to date: https://developmentseed.org/ (click the magnifying glass) |
@icicimov As others have gotten this to work I'm going to close it out. If you have additional information to provide to help resolve it feel free to re-open. |
@JHabdas how was that accomplished? |
lunr.js. they may even have a post about it on that site. those are the guys who created healthcare.gov |
Hi Michael,
I 'm thinking about setting up a site search function and came across this plugin https://github.com/slashdotdash/jekyll-lunr-js-search, that looks not too complicated to implement. Was wondering what are your thoughts on this and is there maybe a guide you would recommend for this functionality?
Thanks
The text was updated successfully, but these errors were encountered: