aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2020-09-15 00:17:28 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2020-09-15 00:17:28 +0200
commitb76bdd715bee152c7f5a3dd377f85d952d8c4724 (patch)
tree8b4c50d4e33ac85ca41bdd66d7a3ae1b727a5353 /assets
parent5cc3d6719cd596c9828c8dce5e9a9e934f333f93 (diff)
#242, Add bookSearchExclude frontmatter param
Diffstat (limited to 'assets')
-rw-r--r--assets/search-data.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/assets/search-data.js b/assets/search-data.js
index f324281..a93664e 100644
--- a/assets/search-data.js
+++ b/assets/search-data.js
@@ -16,8 +16,11 @@
const index = FlexSearch.create('balance', indexCfg);
window.bookSearchIndex = index;
- {{ range $index, $page := where .Site.Pages "Kind" "in" (slice "page" "section") }}
- {{ if $page.Content }}
+ {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
+ {{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
+ {{- $pages = where $pages "Content" "not in" (slice nil "") -}}
+
+ {{ range $index, $page := $pages }}
index.add({
'id': {{ $index }},
'href': '{{ $page.RelPermalink }}',
@@ -26,5 +29,4 @@
'content': {{ $page.Plain | jsonify }}
});
{{- end -}}
- {{- end -}}
})();