From 55f6e8fae509d81fd311893504101111d8281b81 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Fri, 27 May 2022 11:48:46 -0400 Subject: [PATCH] Exclude `main.scss` from Lunr search index --- CHANGELOG.md | 1 + assets/css/main.scss | 1 + assets/js/lunr/lunr-store.js | 3 ++- docs/_docs/18-history.md | 1 + test/_config.yml | 2 ++ 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c38782fd..7ef62f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Enhancements +- Exclude `main.scss` from Lunr search index. - Allow `site.pages` to be indexed and searched via Lunr. [#3352](https://github.com/mmistakes/minimal-mistakes/pull/3352) - Update jQuery to v3.6.0. [#3254](https://github.com/mmistakes/minimal-mistakes/pull/3254) - Use notice `` colors for blockquotes that have `notice--` classes applied. [#3140](https://github.com/mmistakes/minimal-mistakes/pull/3140) [#3068](https://github.com/mmistakes/minimal-mistakes/issues/3068) diff --git a/assets/css/main.scss b/assets/css/main.scss index 23346e77..6d781798 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -1,5 +1,6 @@ --- # Only the main Sass file needs front matter (the dashes are enough) +search: false --- @charset "utf-8"; diff --git a/assets/js/lunr/lunr-store.js b/assets/js/lunr/lunr-store.js index eda552ff..565e3b3e 100644 --- a/assets/js/lunr/lunr-store.js +++ b/assets/js/lunr/lunr-store.js @@ -47,7 +47,8 @@ var store = [ }{%- unless forloop.last and l -%},{%- endunless -%} {%- endfor -%} {%- endfor -%}{%- if site.lunr.search_within_pages -%}, - {%- for doc in site.pages -%} + {%- assign pages = site.pages | where_exp:'doc','doc.search != false' -%} + {%- for doc in pages -%} {%- if forloop.last -%} {%- assign l = true -%} {%- endif -%} diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md index 2e2dc869..572e64b8 100644 --- a/docs/_docs/18-history.md +++ b/docs/_docs/18-history.md @@ -27,6 +27,7 @@ toc: false ### Enhancements +- Exclude `main.scss` from Lunr search index. - Allow `site.pages` to be indexed and searched via Lunr. [#3352](https://github.com/mmistakes/minimal-mistakes/pull/3352) - Update jQuery to v3.6.0. [#3254](https://github.com/mmistakes/minimal-mistakes/pull/3254) - Use notice `` colors for blockquotes that have `notice--` classes applied. [#3140](https://github.com/mmistakes/minimal-mistakes/pull/3140) [#3068](https://github.com/mmistakes/minimal-mistakes/issues/3068) diff --git a/test/_config.yml b/test/_config.yml index 2d09d966..9656a376 100644 --- a/test/_config.yml +++ b/test/_config.yml @@ -52,6 +52,8 @@ atom_feed: search : true # true, false (default) search_full_content : true # true, false (default) search_provider : "lunr" +lunr: + search_within_pages : true algolia: application_id : "QB6HVGBSBA" index_name : "dev_minimal-mistakes"