-
Notifications
You must be signed in to change notification settings - Fork 25.8k
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
lunr search - doesn't index _pages? #1409
Comments
Currently only supports posts and collections. You'd have to alter the code to index pages as well. https://github.com/mmistakes/minimal-mistakes/blob/master/assets/js/lunr-en.js |
Thank you; I could use collections now. It's worth noting - perhaps you can add that info to the guide - that lunr breaks if you use a number as a tag. I had this:
and this causes a JavaScript error
makes it work. |
Looks like the version of Lunr.js included ( @nickgarlis Any particular reason you used an older version of Lunr? I did a quick test by updating to the current version and I get |
Lunr upgrade info https://lunrjs.com/guides/upgrading.html |
@mmistakes I think it had something to do with the custom stemmer that I use to support Greek characters. The error that you get must be because Lunr now gets the documents added in the configuration function. Other than that, I think that upgrading is a good idea and it is something that I had in mind. I will run some tests and if everything works properly, I can pull request the upgrade. |
Sounds good @nickgarlis 😀 |
I just pull requested the update #1419 . Lunr will not break if you use numbers as tags now. Also, Lunr is now configured to search for every word inside of the query string and not just for the whole string. |
If anyone has a modified lunr file that supports pages, I'd sure appreciate a copy. ❤️ |
@Aaronius The Lunr index currently loops through collections documents (... posts). Here's the relevant code. To add pages to the mix you'd have to loop through For a better search experience I'd suggest using Algolia instead. And if you need an example of how to set it up check out this repo. |
Old issue with a really simple fix but here is the modified Lunr file I use to ensure pages are indexed as well. Just in case someone wants to know exactly what to change. Thanks @mmistakes for pointing out the file to change. |
Is there a more streamlined way to apply the changes made by @nandahkrishna? While their lunr file works, I do not understand why the changes are not already made default in the minimal-mistakes repo. Is there some sort of drawback? |
I took a shot at implementing this as an optional config in #3352 Having page indexing was essential for my current project and shoving everything into a collection doesn't really fit my flow. Hope this is useful. |
bundle update
.bundle exec jekyll build
.Information
The site search is a great feature; I can't find much info here, though: https://mmistakes.github.io/minimal-mistakes/docs/configuration/#site-search - simply enabling
search: true
in_config.yml
makes it possible to search through_posts
, but it doesn't seem to index_pages
.How can I make the search feature include all texts in
_pages
as well?The text was updated successfully, but these errors were encountered: