aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/_default/search.json
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-11-09 17:49:27 +0100
committerOscar Najera <hi@oscarnajera.com>2023-11-09 17:49:27 +0100
commit4a826ff2748eafdbf63dd0547706ed7dc7ed3d76 (patch)
tree17b3f45d8b750d7fbd1de718e87fdcbfa44e7e5a /layouts/_default/search.json
parent76b72515b6d8078268077bd9d96db493fb7bd6f8 (diff)
downloadhugo-minimalist-theme-4a826ff2748eafdbf63dd0547706ed7dc7ed3d76.tar.gz
hugo-minimalist-theme-4a826ff2748eafdbf63dd0547706ed7dc7ed3d76.tar.bz2
hugo-minimalist-theme-4a826ff2748eafdbf63dd0547706ed7dc7ed3d76.zip
Search page
Diffstat (limited to 'layouts/_default/search.json')
-rw-r--r--layouts/_default/search.json13
1 files changed, 13 insertions, 0 deletions
diff --git a/layouts/_default/search.json b/layouts/_default/search.json
new file mode 100644
index 0000000..16912cb
--- /dev/null
+++ b/layouts/_default/search.json
@@ -0,0 +1,13 @@
+
+{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
+{{- $.Scratch.Add "index" slice -}}
+{{- range (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}}
+
+ {{- $.Scratch.Add "index" (dict "title" .Title
+ "tags" .Params.tags
+ "categories" .Params.categories
+ "contents" (.Summary | plainify)
+ "date" (.Date.Format $dateFormat)
+ "permalink" .Permalink) -}}
+{{- end -}}
+{{- $.Scratch.Get "index" | jsonify -}}