#242, Add bookSearchExclude frontmatter param

This commit is contained in:
Alex Shpak
2020-09-15 00:17:28 +02:00
parent 5cc3d6719c
commit b76bdd715b
2 changed files with 30 additions and 24 deletions
+5 -3
View File
@@ -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 -}}
})();