website/layouts/_default/search.json

18 lines
512 B
JSON

{{ define "main" }}
{
{{ $mscratch := newScratch }}
{{ $mscratch.Add "articles" slice }}
{{ range .Site.RegularPages }}
{{ $mscratch.Add "articles" (dict
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (or .Params.tags slice)
"summary" .Summary
"text" (lower .Plain)
"link" .Permalink
"image" (or .Params.Image "")) }}
{{ end }}
"pages": {{ $mscratch.Get "articles" | jsonify }}
}
{{ end }}