init
This commit is contained in:
26
themes/godocs-1/layouts/_default/index.json
Normal file
26
themes/godocs-1/layouts/_default/index.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{{- /* Verzamel alle pagina's die je wilt doorzoeken */ -}}
|
||||
{{- $pages := where .Site.Pages "Type" "!=" "json" -}}
|
||||
{{- $pages = where $pages "Params.ignoreSearch" "!=" true -}}
|
||||
|
||||
{{- /* Bouw een slice met objecten voor de search-JSON */ -}}
|
||||
{{- $items := slice -}}
|
||||
|
||||
{{- range $e := $pages -}}
|
||||
{{- $section := "" -}}
|
||||
{{- with $e.Section }}{{ $section = . | humanize }}{{ end -}}
|
||||
|
||||
{{- $title := cond (isset $e.Params "bannertext") $e.Params.bannertext $e.Title -}}
|
||||
|
||||
{{- $obj := dict
|
||||
"section" $section
|
||||
"url" $e.Permalink
|
||||
"title" $title
|
||||
"description" $e.Description
|
||||
"searchKeyword" $e.Params.searchKeyword
|
||||
"content" $e.Plain
|
||||
-}}
|
||||
{{- $items = $items | append $obj -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Laat Hugo alles in één keer omzetten naar geldige JSON */ -}}
|
||||
{{- $items | jsonify -}}
|
||||
Reference in New Issue
Block a user