From 69ecbd2c4682c1ebbc6b7be776c4599912d035a4 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 c38782fddaa1..7ef62f0e809b 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 23346e773b1b..6d781798bf85 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 eda552ffcba8..565e3b3e4e7c 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 2e2dc869c440..572e64b8e82d 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 2d09d9667132..9656a3764878 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"