From 4a826ff2748eafdbf63dd0547706ed7dc7ed3d76 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Thu, 9 Nov 2023 17:49:27 +0100 Subject: Search page --- layouts/_default/search.html | 45 ++++++++++++++++++++++++++++++++++++++++++++ layouts/_default/search.json | 13 +++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 layouts/_default/search.html create mode 100644 layouts/_default/search.json (limited to 'layouts/_default') diff --git a/layouts/_default/search.html b/layouts/_default/search.html new file mode 100644 index 0000000..bcbaad4 --- /dev/null +++ b/layouts/_default/search.html @@ -0,0 +1,45 @@ +{{ define "main" }} +
+
+

+ {{ .Title }} +

+
+ +
+ +
+ +
+
+ + + + + {{ with resources.Get "js/search.js" | resources.Minify | fingerprint }} + + {{ end }} +{{ end }} 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 -}} -- cgit v1.2.3