From 4526ccf9efedf3dd5c73947f70fbbdf0efea71ab Mon Sep 17 00:00:00 2001 From: Matthew Cengia Date: Mon, 26 Jun 2023 14:51:42 -0700 Subject: [PATCH] Fix archive page using custom section template Closes #2, #8 --- content/archive | 1 - content/archive/_index.md | 0 layouts/section/archive.html | 23 +++++++++++++++++++++++ layouts/section/archive.xml | 28 ++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) delete mode 120000 content/archive create mode 100644 content/archive/_index.md create mode 100644 layouts/section/archive.html create mode 100644 layouts/section/archive.xml diff --git a/content/archive b/content/archive deleted file mode 120000 index fdd6dbd..0000000 --- a/content/archive +++ /dev/null @@ -1 +0,0 @@ -posts \ No newline at end of file diff --git a/content/archive/_index.md b/content/archive/_index.md new file mode 100644 index 0000000..e69de29 diff --git a/layouts/section/archive.html b/layouts/section/archive.html new file mode 100644 index 0000000..5c66dea --- /dev/null +++ b/layouts/section/archive.html @@ -0,0 +1,23 @@ +{{- define "main" -}} +
+
+

{{ .Title }}

+
+
+ {{ range .Site.RegularPages.GroupByDate "2006" }} + {{ $year := .Key }} +

{{ $year }}

+ + {{/* create a list of posts for each month, with month as heading */}} + + {{ range .Pages }} + + {{ partial "postCard" . }} + + {{ end }} {{/* end range .Pages */}} + + {{ end }} {{/* end range .Pages.GroupByDate "2006" */}} + +
+
+{{- end -}} diff --git a/layouts/section/archive.xml b/layouts/section/archive.xml new file mode 100644 index 0000000..c005074 --- /dev/null +++ b/layouts/section/archive.xml @@ -0,0 +1,28 @@ +{{- $pages := .Site.RegularPages -}} +{{- printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + +