From b76bdd715bee152c7f5a3dd377f85d952d8c4724 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 15 Sep 2020 00:17:28 +0200 Subject: #242, Add bookSearchExclude frontmatter param --- assets/search-data.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'assets') 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 -}} })(); -- cgit v1.2.3