From cdc7e072f231ed25077687af51ebb220016d0366 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Fri, 10 Jun 2022 18:40:21 -0700 Subject: [PATCH] Add cover image support and improve meta tags --- layouts/partials/datestamp.html | 1 + layouts/partials/head.html | 42 ++++++++++++++++++++++++++++++++- layouts/partials/metadata.html | 10 ++++---- layouts/partials/time.html | 2 +- 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 layouts/partials/datestamp.html diff --git a/layouts/partials/datestamp.html b/layouts/partials/datestamp.html new file mode 100644 index 0000000..b09082e --- /dev/null +++ b/layouts/partials/datestamp.html @@ -0,0 +1 @@ +{{ .Format "2006-01-02T15:04:05Z07:00" -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 18e5863..4defad2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,6 +1,46 @@ + {{ $title := cond .IsHome .Site.Title (printf "%s" .Title | printf "%s%s" (cond (and (eq .Kind "term") (eq .Data.Singular "tag")) "#" "") | printf "%s") }} + + {{ with .Resources.GetMatch "{cover.*,*.jpg,*.png,*.jpeg}" }} + + {{ end }} + {{ with .Params.description }} + + + {{ end }} + + {{ if eq .Kind "page" }} + {{ with .PublishDate }} + + {{ end }} + {{ with .Lastmod }} + + {{ end }} + {{ with .ExpiryDate }} + + {{ end }} + {{ with .Params.tags }} + {{ range . }} + + {{ end }} + {{ end }} + {{ with .Site.Params.AuthorProfile }} + + {{ end }} + {{ end }} + {{ with .Site.Params.Author }} + + {{ end }} + + + {{ with .Site.Params.SiteTwitter }} + + {{ end }} + {{ with .Site.Params.AuthorTwitter }} + + {{ end }} {{ if isset .Site.Params "matomositeid" }} @@ -18,5 +58,5 @@ })(); {{ end }} - {{ if and (eq .Kind "term") (eq .Data.Singular "tag") }}#{{ end }}{{ .Title }}{{ if not .IsHome }} - {{ .Site.Title }}{{ end }} + {{ $title }}{{ if not .IsHome }} - {{ .Site.Title }}{{ end }} diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html index f8c0e7d..519229f 100644 --- a/layouts/partials/metadata.html +++ b/layouts/partials/metadata.html @@ -1,7 +1,9 @@ +{{ with .Resources.GetMatch "{cover.*,*.jpg,*.png,*.jpeg}" }} + +{{ end }} Posted by {{ .Site.Params.author }} on {{ partial "time.html" . }} -

+
{{ range $i, $e := .Params.tags -}} - {{- if $i -}}, {{ end -}} - +{{- if $i -}}, {{ end -}} + {{- end -}} -

diff --git a/layouts/partials/time.html b/layouts/partials/time.html index bb6550a..8f4b78b 100644 --- a/layouts/partials/time.html +++ b/layouts/partials/time.html @@ -1 +1 @@ - +