From 7e8b6f90de4c0d68f1f0140190abf772c0ad9c2a Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Tue, 21 Feb 2023 20:33:47 +0100 Subject: [PATCH] =?UTF-8?q?Templates=20f=C3=BCr=20Vorschaubilder=20aktuali?= =?UTF-8?q?siert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + layouts/partials/head.html | 4 +-- layouts/partials/opengraph.html | 47 +++++++++++++++++++++++++++++++++ layouts/partials/twitter.html | 29 ++++++++++++++++++++ 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/opengraph.html create mode 100644 layouts/partials/twitter.html diff --git a/.gitignore b/.gitignore index bf276b2f..9f9bf715 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .hugo_build.lock resources/ +public/ diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 276fd677..af6ba4a8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -38,7 +38,7 @@ - {{ template "_internal/opengraph.html" . }} - {{ template "_internal/twitter_cards.html" . }} + {{ partial "opengraph" . }} + {{ partial "twitter" . }} diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html new file mode 100644 index 00000000..7192a966 --- /dev/null +++ b/layouts/partials/opengraph.html @@ -0,0 +1,47 @@ + + + + + +{{- with $.Params.images -}} +{{- range first 6 . }}{{ end -}} +{{- else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + +{{- else -}} +{{- with $.Params.image -}} + +{{- else -}} +{{- with $.Site.Params.images }}{{ end -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }}{{ end }} +{{- with .Site.Params.title }}{{ end }} +{{- with .Params.videos }}{{- range . }} + +{{ end }}{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{- if $siteSeries }} +{{ with .Params.series }}{{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }}{{ end }} + {{- end }} +{{ end }}{{ end }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/twitter.html b/layouts/partials/twitter.html new file mode 100644 index 00000000..317106e6 --- /dev/null +++ b/layouts/partials/twitter.html @@ -0,0 +1,29 @@ +{{- with $.Params.images -}} + + +{{ else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + + +{{- else -}} +{{- with $.Params.image -}} + + +{{- else -}} +{{- with $.Site.Params.images -}} + + +{{ else -}} + +{{- end -}} +{{- end -}} +{{- end -}} +{{- end }} + + +{{ with .Site.Social.twitter -}} + +{{ end -}} \ No newline at end of file