hyde
hyde copied to clipboard
Search on site
Typical blog site will have a lot of posts. I was wondering if it is possible to implement a search algorithm that allows the user to search for topics. I have already implemented a tagging system, but what if people want to search for a particular word or phrase, which is not a tag. Can this even be implemented in a static site?
Hello @divush.
I'm the author of the jekyll-algolia plugin that does exactly what you're suggesting: adding search to a Jekyll website. It works by extracting all content from the posts/pages and pushing them to the Algolia API. You then trigger a search from the front-end by directly calling the Algolia API in JavaScript. You can check a live demo here if you're interested.
As a matter of fact, I'd be happy to submit a PR to add this plugin to the theme if the maintainers think it's worth it. Another theme (Minimal Mistakes) already implemented it (with a fallback to Lunr.js in case you don't want to use Algolia).