Skip to content

Commit

Permalink
Merge pull request #39 from rootwork/fix/37-exclude-search
Browse files Browse the repository at this point in the history
Excluding unlisted pages from search results
  • Loading branch information
rootwork authored Oct 2, 2022
2 parents 6129298 + 5854b1d commit 757c9c5
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 757c9c5

Please sign in to comment.