mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Pages with the 'excludeFromSearch' parameter set in their front matter are now omitted from the generated search index. This allows for finer control over which pages are searchable.
33 lines
1.1 KiB
JSON
33 lines
1.1 KiB
JSON
{{- $index := slice -}}
|
|
{{ $pages := .Site.Pages }}
|
|
{{ range .Site.Home.Translations }}
|
|
{{ $pages = $pages | lang.Merge .Site.Pages }}
|
|
{{ end }}
|
|
{{- range $pages -}}
|
|
{{- if not .Params.excludeFromSearch -}}
|
|
{{- $section := .Site.GetPage "section" .Section -}}
|
|
{{- if .Date -}}
|
|
{{- $index = $index | append (dict
|
|
"date" (.Date | time.Format (.Site.Language.Params.dateFormat | default ":date_long"))
|
|
"title" (.Title | emojify | safeJS)
|
|
"section" ($section.Title | emojify | safeJS)
|
|
"summary" (.Summary | safeJS)
|
|
"content" (.Plain | safeJS)
|
|
"permalink" .RelPermalink
|
|
"externalUrl" .Params.externalUrl
|
|
"type" .Type
|
|
) -}}
|
|
{{- else -}}
|
|
{{- $index = $index | append (dict
|
|
"title" (.Title | emojify | safeJS)
|
|
"section" ($section.Title | emojify | safeJS)
|
|
"summary" (.Summary | safeJS)
|
|
"content" (.Plain | safeJS)
|
|
"permalink" .RelPermalink
|
|
"externalUrl" .Params.externalUrl
|
|
"type" .Type
|
|
) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $index | jsonify -}} |