minimal-mistakes icon indicating copy to clipboard operation
minimal-mistakes copied to clipboard

Exclude lunr-en.js from Lunr search index

Open JMuff22 opened this issue 3 years ago • 4 comments

This is a bug fix.

Summary

Added the search: false to lunr-en.js to exclude it from the Lunr search index when enabling "search_within_pages" in the configuration file.

Context

This fixes a bug which was occurring in my own deployment of Minimal Mistakes where searching for specific terms was returning the lunr-en.js file. Searches now correctly return the right list based on search term.

Other files may also need changing as well as this file if they are never needed in the search box e.g all files in assets/.

JMuff22 avatar Jun 28 '22 11:06 JMuff22

I sort of feel like this patch should be applied to all lunr-*.js files. Can you verify if that causes any negative impact? If not would you apply to all such JS files?

iBug avatar Jun 28 '22 11:06 iBug

This shouldn't cause any negative impact to searching.

lunr-gr.js- No problems searching in English and doesn't show up in searches. Cannot test Greek letters though.

lunr-en.js - No problems searching in English and doesn't show up in searches lunr-store.js- No problems searching in English and doesn't show up in searches

I would apply to all such JS files and if someone who is Greek or uses a website with Greek letters in could test that would be great.

JMuff22 avatar Jun 28 '22 12:06 JMuff22

I'm also getting sitemap.xml in the search, and possibly others. I tried adding these to the "exclude:" section in _config.xml but it didn't do what I expected.

Is there a way to avoiding needing to add this to the frontmatter of every file I don't want indexed?

ultimape avatar Jul 05 '22 11:07 ultimape

I resolved sitemap.xml and feed.xml from showing up in the search by commenting out these jekyll plugins. See https://github.com/FiQCI/dev/commit/b4da2aaa7c002861fbc4ca43f1f8752098af951f

JMuff22 avatar Jul 05 '22 11:07 JMuff22