From 41df0128d69b344050ef12f2dcd884e635a3299f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 31 May 2022 09:35:31 +0200 Subject: Add tagging support --- layouts/_default/list.html | 23 +++++++++++++++++++++++ layouts/_default/list.html.html | 24 ------------------------ layouts/_default/single.html | 4 ++++ layouts/_default/term.html | 26 ++++++++++++++++++++++++++ layouts/partials/post-meta/date.html | 21 ++++++++++++--------- layouts/partials/post-tags.html | 9 +++++++++ layouts/partials/title.html | 2 ++ 7 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 layouts/_default/list.html delete mode 100644 layouts/_default/list.html.html create mode 100644 layouts/_default/term.html create mode 100644 layouts/partials/post-tags.html (limited to 'layouts') diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..0dd32b6 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,23 @@ +{{ define "main" }} + +
+ {{ with .Title }}

{{ . }}

{{ end }} + + {{/* Render category content if any */}} + {{ with .Content }} +
+ {{ .Content }} +
+ {{ end }} + + {{/* Render posts list */}} +
+ {{ range .Paginator.Pages }} + {{ .Render "teaser" }} + {{ end }} + + {{- partial "pagination.html" . -}} +
+
+ +{{ end }} diff --git a/layouts/_default/list.html.html b/layouts/_default/list.html.html deleted file mode 100644 index fc39714..0000000 --- a/layouts/_default/list.html.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ define "main" }} - -
- {{/* Render category name if any */}} - {{ with .Title }}

{{ . }}

{{ end }} - - {{/* Render category content if any */}} - {{ with .Content }} -
- {{ .Content }} -
- {{ end }} - - {{/* Render posts list */}} -
- {{ range .Paginator.Pages }} - {{ .Render "teaser" }} - {{ end }} - - {{- partial "pagination.html" . -}} -
-
- -{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6b2c851..56557e5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -13,5 +13,9 @@
{{ .Content }}
+ +
+ {{ partial "post-tags.html" . }} +
{{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html new file mode 100644 index 0000000..6ad5d40 --- /dev/null +++ b/layouts/_default/term.html @@ -0,0 +1,26 @@ +{{ define "main" }} + +
+ {{/* TODO: Translate me */}} +

+ {{ with .Title }}{{ i18n "publications_tagged" . }}{{ end }} +

+ + {{/* Render category content if any */}} + {{ with .Content }} +
+ {{ .Content }} +
+ {{ end }} + + {{/* Render posts list */}} +
+ {{ range .Paginator.Pages }} + {{ .Render "teaser" }} + {{ end }} + + {{- partial "pagination.html" . -}} +
+
+ +{{ end }} diff --git a/layouts/partials/post-meta/date.html b/layouts/partials/post-meta/date.html index 04a814a..e5626cf 100644 --- a/layouts/partials/post-meta/date.html +++ b/layouts/partials/post-meta/date.html @@ -1,11 +1,14 @@ -{{ if not .Date.IsZero }} - +{{ $date := .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }} +{{ $lastmod := .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }} + + - {{ if ne .Date .Lastmod }} - - {{ end }} +{{/* Check that lastmod exists and is greater than date + (i.e. the last modified date must be after the publish date) */}} +{{ if and (ne $lastmod $date) (gt .Lastmod .Date) }} + {{ end }} diff --git a/layouts/partials/post-tags.html b/layouts/partials/post-tags.html new file mode 100644 index 0000000..1fa1c96 --- /dev/null +++ b/layouts/partials/post-tags.html @@ -0,0 +1,9 @@ +{{ $tags := .Params.Tags | default slice }} + + diff --git a/layouts/partials/title.html b/layouts/partials/title.html index 76cfb2f..b3754ba 100644 --- a/layouts/partials/title.html +++ b/layouts/partials/title.html @@ -1,5 +1,7 @@ {{- if or .IsHome (eq .Title site.Title) -}} {{- site.Title -}} +{{- else if and (eq .Kind "term") (eq .Data.Singular "tag") -}} + {{- with .Title }}{{ i18n "publications_tagged" . }} - {{ end }}{{ site.Title -}} {{- else -}} {{- with .Title }}{{ . }} - {{ end }}{{ site.Title -}} {{- end -}} -- cgit v1.2.3