From b31611af40661eb3cc7fd456e7c64ebc7853c13b Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 19 Mar 2025 13:19:37 -0400 Subject: [PATCH] properly format metadata and previous and next pages --- layouts/_default/single.html | 24 +++++++++-------------- layouts/blog/list.html | 4 ++-- layouts/partials/prev-next.html | 13 ++++++++++++ layouts/partials/taxonomy/categories.html | 8 ++++++++ 4 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 layouts/partials/prev-next.html create mode 100644 layouts/partials/taxonomy/categories.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3cc4324..cfb6ea5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -11,15 +11,9 @@ {{ if .Params.showMetadata | default true }}
- {{ with .GetTerms "tags" }} - {{ partial "taxonomy/tags.html" . }} - {{ end }} {{ with .GetTerms "authors" }} {{ partial "taxonomy/authors.html" . }} {{ end }} - {{ with .GetTerms "categories" }} - {{ partial "taxonomy/categories.html" . }} - {{ end }} {{ if .Site.Params.published | default true }}
{{ i18n "published" }}
{{ $formattedDate := .Date.Format "2006-01-02" }} @@ -29,16 +23,14 @@
{{ i18n "reading_time" }}
{{ i18n "reading_time_desc" .ReadingTime }}
{{ end }} + {{ with .GetTerms "categories" }} + {{ partial "taxonomy/categories.html" . }} + {{ end }} + {{ with .GetTerms "tags" }} + {{ partial "taxonomy/tags.html" . }} + {{ end }}
-{{ $pages := .CurrentSection.Pages.ByWeight }} - -{{ with $pages.Prev . }} -« Entrada anterior -{{ end }} -/ -{{ with $pages.Next . }} - Entrada siguiente » -{{ end }} + {{ template "partials/prev-next.html" . }}
{{ end }}
@@ -66,9 +58,11 @@ {{ end }} {{ end }} +

+ {{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 0ffa94e..a6c0147 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -25,7 +25,7 @@
- {{ .Title }} + {{ .Title }} {{ $formattedDate := .Date.Format "2006-01-02" }}
@@ -33,7 +33,7 @@

{{ .Summary }}

- + {{ range .Pages.ByWeight }}

{{ .LinkTitle }}

{{ end }} diff --git a/layouts/partials/prev-next.html b/layouts/partials/prev-next.html new file mode 100644 index 0000000..1345742 --- /dev/null +++ b/layouts/partials/prev-next.html @@ -0,0 +1,13 @@ +{{ $pages := .CurrentSection.Pages.ByDate.Reverse }} + +{{ with $pages.Prev . }} + « Entrada anterior +{{ else }} + {{ print "« Entrada anterior" }} +{{ end }} +| +{{ with $pages.Next . }} + Entrada siguiente » +{{ else }} + {{ print "Entrada siguiente »" }} +{{ end }} diff --git a/layouts/partials/taxonomy/categories.html b/layouts/partials/taxonomy/categories.html new file mode 100644 index 0000000..1716e84 --- /dev/null +++ b/layouts/partials/taxonomy/categories.html @@ -0,0 +1,8 @@ + +
{{ i18n "categories" }}
+
+{{- range $index, $el := . -}} + / + {{- .LinkTitle -}} +{{- end -}} +