In the same vein as the original search post with lunr, I’ve implemented search on my blog. However, a key difference: the generation of the lunr index is taken care of in a Hugo template instead of a grunt task. This means three things:
you don’t have to install node, if you don’t want to.
you don’t have to run a separate process to generate the index. This means it works with livereload!
there’s no extra HTTP request to get the search index on the search page.
Not a stupid question at all, I don’t think. Yes, it works with GH
pages. In fact, that’s where the sample blog I posted lives. Check out
the .travis.yml for how it gets built automatically.
Happy to see someone did this as when I read that original post, my first thought was ‘couldn’t that be done in Hugo?’ but I hadn’t tried it.
@samrich rendering search suggestions in real time would be about the script performing the search, not down to the method used to create the index. So in this case just depends what lunr does (not used it yet myself)
I am interested in a nice on-site search as well. Checked out your page, however, the search does not work for me. If I type something and press enter, nothing happens at all. Am I stupid?
The input field above the results is doing nothing, but look at the menu and you see ‘spacemacs’. It’s a field with the keyword. Change it and the page will show new results via ajax.