From 85db458aa1042a458df5c5a25d70dd06655c924a Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Thu, 10 Sep 2026 00:41:20 +0800 Subject: Add updated document archive --- layouts/partials/updated-items.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 layouts/partials/updated-items.html (limited to 'layouts/partials/updated-items.html') diff --git a/layouts/partials/updated-items.html b/layouts/partials/updated-items.html new file mode 100644 index 0000000..5f738a8 --- /dev/null +++ b/layouts/partials/updated-items.html @@ -0,0 +1,16 @@ +{{- $items := slice -}} +{{- range $section := slice "journal" "notes" -}} + {{- $kind := cond (eq $section "notes") "note" "journal" -}} + {{- range where site.RegularPages "Section" $section -}} + {{- if not .Params.created -}} + {{- errorf "Missing required created date in %s" .File.Path -}} + {{- end -}} + {{- if not .Params.updated -}} + {{- errorf "Missing required updated date in %s" .File.Path -}} + {{- end -}} + {{- $sortDate := time.Format "2006-01-02" .Params.updated -}} + {{- $sortKey := printf "%s|%s" $sortDate .RelPermalink -}} + {{- $items = $items | append (dict "page" . "kind" $kind "sortDate" $sortDate "sortKey" $sortKey) -}} + {{- end -}} +{{- end -}} +{{- return (sort $items "sortKey" "desc") -}} -- cgit v1.2.3