From 5854b1de89819c6afbed0eaee6aa7e372d7877c4 Mon Sep 17 00:00:00 2001 From: Ivan Boothe Date: Sun, 2 Oct 2022 07:22:11 +0000 Subject: [PATCH] excluding unlisted pages from search results --- hugo/layouts/_default/index.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 hugo/layouts/_default/index.json diff --git a/hugo/layouts/_default/index.json b/hugo/layouts/_default/index.json new file mode 100644 index 00000000..7d4010bd --- /dev/null +++ b/hugo/layouts/_default/index.json @@ -0,0 +1,10 @@ +{{- $.Scratch.Add "index" slice -}} +{{- $pages := .Site.Pages }} +{{- $pages = where $pages ".Params.unlisted" "!=" true -}} + +{{- range $pages -}} + {{- if ne .Type "search" -}} + {{- $.Scratch.Add "index" (dict "title" .Title "body" .Plain "link" .Permalink "section" .Section "tags" .Params.tags) -}} + {{- end -}} +{{- end -}} +{{- jsonify (uniq ($.Scratch.Get "index")) -}}