From ca69a65980de6168997d5211477b9fc214767f8e Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 17 Mar 2025 17:26:54 -0400 Subject: [PATCH] add pagination to blog, categories and tags, and fix some issues and typos --- i18n/es.toml | 2 +- layouts/blog/list.html | 44 +++++++++++ layouts/categories/list.html | 44 +++++++++++ layouts/partials/custom-head.html | 29 ++++++++ layouts/partials/pagination.html | 120 ++++++++++++++++++++++++++++++ layouts/tags/list.html | 44 +++++++++++ 6 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 layouts/blog/list.html create mode 100644 layouts/categories/list.html create mode 100644 layouts/partials/pagination.html create mode 100644 layouts/tags/list.html diff --git a/i18n/es.toml b/i18n/es.toml index 63c01c7..45dd777 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -2,7 +2,7 @@ other = "NO ENCONTRADO" [not_found_desc] - other = "Haz tomado una ruta que no existe..." + other = "Has tomado una ruta que no existe..." [home] other = "Inicio" diff --git a/layouts/blog/list.html b/layouts/blog/list.html new file mode 100644 index 0000000..0bff877 --- /dev/null +++ b/layouts/blog/list.html @@ -0,0 +1,44 @@ +{{ define "title"}} +{{ .Title }} | {{ .Site.Params.author.name }} +{{ end }} + +{{ define "main" }} + +
+
+

{{ .Title }}

+
+ + {{ with .Content }} +
+ {{- . -}} +
+ {{ end }} + +
+ {{ $pages := where site.RegularPages "Type" "blog" }} + {{ $paginator := .Paginate $pages.ByDate.Reverse 10 }} + + {{ range $paginator.Pages.ByDate.Reverse }} + + + +
+
+ {{ .Title }} + {{ $formattedDate := .Date.Format "2006-01-02" }} + +
+
+

{{ .Summary }}

+
+
+
+ + + {{end}} + {{ template "partials/pagination.html" . }} +
+
+ +{{ end }} diff --git a/layouts/categories/list.html b/layouts/categories/list.html new file mode 100644 index 0000000..11d6990 --- /dev/null +++ b/layouts/categories/list.html @@ -0,0 +1,44 @@ +{{ define "title"}} +{{ .Title }} | {{ .Site.Params.author.name }} +{{ end }} + +{{ define "main" }} + +
+
+

{{ .Title }}

+
+ + {{ with .Content }} +
+ {{- . -}} +
+ {{ end }} + +
+ {{ $pages := where site.RegularPages "Type" "categories" }} + {{ $paginator := .Paginate (where .Data.Pages "Type" "blog") 10 }} + + {{ range $paginator.Pages.ByDate.Reverse }} + + + +
+
+ {{ .Title }} + {{ $formattedDate := .Date.Format "2006-01-02" }} + +
+
+

{{ .Summary }}

+
+
+
+ + + {{end}} + {{ template "partials/pagination.html" . }} +
+
+ +{{ end }} diff --git a/layouts/partials/custom-head.html b/layouts/partials/custom-head.html index 4a789ff..4445f4c 100644 --- a/layouts/partials/custom-head.html +++ b/layouts/partials/custom-head.html @@ -3,6 +3,35 @@