introduce searchHidden front-matter var

- to hide particular pages from search

usage:
in page's front-matter add
searchHidden: true
This commit is contained in:
Aditya Telange 2021-01-30 12:50:16 +05:30
parent 6c79b99de8
commit 0c28a4ad5a
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -1,6 +1,7 @@
{{- $.Scratch.Add "index" slice -}} {{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}} {{- range .Site.RegularPages -}}
{{- if not .Params.searchHidden }}
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}} {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end }}
{{- end -}} {{- end -}}
{{- $.Scratch.Get "index" | jsonify -}} {{- $.Scratch.Get "index" | jsonify -}}