Skip to content

Commit

Permalink
excluding unlisted pages from search results
Browse files Browse the repository at this point in the history
  • Loading branch information
rootwork committed Oct 2, 2022
1 parent d58884e commit 5854b1d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hugo/layouts/_default/index.json
Original file line number Diff line number Diff line change
@@ -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")) -}}

0 comments on commit 5854b1d

Please sign in to comment.