From: Kai Moritz Date: Sat, 22 Nov 2025 11:20:03 +0000 (+0100) Subject: `section`-Template für den Blog auf von PaperMod übernommen X-Git-Tag: frontend--hugo--rebase--2025-12-21--19-20~23 X-Git-Url: https://juplo.de/gitweb/?a=commitdiff_plain;h=eb999de7ae3e63088053bfeb3e520cb9d8ef39d4;p=website `section`-Template für den Blog auf von PaperMod übernommen --- diff --git a/layouts/_partials/author.html b/layouts/_partials/author.html new file mode 100644 index 00000000..8f2758fa --- /dev/null +++ b/layouts/_partials/author.html @@ -0,0 +1,9 @@ +{{- if or .Params.author site.Params.author }} +{{- $author := (.Params.author | default site.Params.author) }} +{{- $author_type := (printf "%T" $author) }} +{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }} +{{- (delimit $author ", " ) }} +{{- else }} +{{- $author }} +{{- end }} +{{- end -}} diff --git a/layouts/_partials/post_meta.html b/layouts/_partials/post_meta.html new file mode 100644 index 00000000..ae996bad --- /dev/null +++ b/layouts/_partials/post_meta.html @@ -0,0 +1,23 @@ +{{- $scratch := newScratch }} + +{{- if not .Date.IsZero -}} +{{- $scratch.Add "meta" (slice (printf "%s" (.Date) (.Date | time.Format (default ":date_long" site.Params.DateFormat)))) }} +{{- end }} + +{{- if (.Param "ShowReadingTime") -}} +{{- $scratch.Add "meta" (slice (printf "%s" (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime)))) }} +{{- end }} + +{{- if (.Param "ShowWordCount") -}} +{{- $scratch.Add "meta" (slice (printf "%s" (i18n "words" .WordCount | default (printf "%d words" .WordCount)))) }} +{{- end }} + +{{- if not (.Param "hideAuthor") -}} +{{- with (partial "author.html" .) }} +{{- $scratch.Add "meta" (slice (printf "%s" .)) }} +{{- end }} +{{- end }} + +{{- with ($scratch.Get "meta") }} +{{- delimit . " Â· " | safeHTML -}} +{{- end -}} diff --git a/layouts/baseof.html b/layouts/baseof.html index 0bb66c6e..5558c03e 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -9,7 +9,11 @@ {{- partial "breadcrumb.html" . }}
-

{{ .Title }}

+
+ {{- block "title" . }} +

{{ .Title }}

+ {{ end }} +
{{- block "main" . }}{{ end }}
diff --git a/layouts/blog/section.html b/layouts/blog/section.html new file mode 100644 index 00000000..46d76f64 --- /dev/null +++ b/layouts/blog/section.html @@ -0,0 +1,74 @@ +{{- define "title" }} +

+ {{ .Title }} + {{- if (.Param "ShowRssButtonInSectionTermList") }} + {{- $rss := (.OutputFormats.Get "rss") }} + {{- if (eq .Kind `page`) }} + {{- $rss = (.Parent.OutputFormats.Get "rss") }} + {{- end }} + {{- with $rss }} + + + + + + + + {{- end }} + {{- end }} +

+ {{- if .Description }} +
+ {{ .Description }} +
+ {{- end }} +{{- end }} + +{{- define "main" }} +{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + +{{- if site.Params.ShowAllPagesInArchive }} +{{- $pages = site.RegularPages }} +{{- end }} + +{{- range $pages.GroupByPublishDate "2006" }} +{{- if ne .Key "0001" }} +
+ {{- $year := replace .Key "0001" "" }} +

+ + {{- $year -}} + +

+ {{- range .Pages.GroupByDate "January" }} +
+
+ {{- range .Pages }} + {{- if eq .Kind "page" }} +
+

+ {{- .Title | markdownify }} + {{- if .Draft }} + + + + + + {{- end }} +

+
+ {{- partial "post_meta.html" . -}} +
+
+ {{- end }} + {{- end }} +
+
+ {{- end }} +
+{{- end }} +{{- end }} + +{{- end }}{{/* end main */}}