From 78808adbbce3061157ec676391058d6a7eb7225c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 17 Feb 2024 00:39:06 +0100 Subject: [PATCH] social: wildspace --- layouts/partials/opengraph.html | 101 ++++++++++++++-------------- layouts/partials/twitter_cards.html | 30 ++++----- 2 files changed, 67 insertions(+), 64 deletions(-) diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index 8525069012..e8f772e476 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -8,13 +8,13 @@ {{- $page := . }} {{- $title := .Title }} {{- if eq $outputFormat "searchpage" }} - {{- $title = T "Search" }} + {{- $title = T "Search" }} {{- else if eq .Kind "taxonomy" }} - {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} + {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} {{- else if eq .Kind "term" }} - {{- $taxonomy_page := .Site.GetPage .Data.Plural }} - {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} - {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} + {{- $taxonomy_page := .Site.GetPage .Data.Plural }} + {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} {{- end }} {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} @@ -24,50 +24,52 @@ {{- with $.Params.images }} - {{- range first 6 . }} + {{- range first 6 . }} - {{- end }} + {{- end }} {{- else }} - {{- $images := $.Resources.ByType "image" }} - {{- $featured := $images.GetMatch "*feature*" }} - {{- if not $featured }} - {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} - {{- end }} - {{- with $featured }} + {{- $images := $.Resources.ByType "image" }} + {{- $featured := $images.GetMatch "*feature*" }} + {{- if not $featured }} + {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} + {{- end }} + {{- with $featured }} - {{- else }} - {{- with $.Site.Params.images }} + {{- else }} + {{- with $.Site.Params.images }} - {{- end }} {{- end }} + {{- end }} {{- end }} + {{- if .IsPage }} - {{- $iso8601 := "2006-01-02T15:04:05-07:00" }} - {{- with .Parent }} - {{- $page := . }} - {{- $link := "" }} - {{- $title := .Title }} - {{- if eq $outputFormat "searchpage" }} - {{- $title = T "Search" }} - {{- else if eq .Kind "taxonomy" }} - {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} - {{- else if eq .Kind "term" }} - {{- $taxonomy_page := .Site.GetPage .Data.Plural }} - {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} - {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} - {{- end }} - {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} - {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} - {{- end }} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" }} + {{- with .Parent }} + {{- $page := . }} + {{- $link := "" }} + {{- $title := .Title }} + {{- if eq $outputFormat "searchpage" }} + {{- $title = T "Search" }} + {{- else if eq .Kind "taxonomy" }} + {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} + {{- else if eq .Kind "term" }} + {{- $taxonomy_page := .Site.GetPage .Data.Plural }} + {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} + {{- end }} + {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} + {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} + {{- end }} - {{- end }} - {{- with .PublishDate }} + {{- end }} + {{- with .PublishDate }} - {{- end }} - {{- with .Lastmod }} + {{- end }} + {{- with .Lastmod }} - {{- end }} + {{- end }} {{- end }} + {{- with .Params.audio }} {{- end }} @@ -78,24 +80,25 @@ {{- end }} {{- with .Params.videos }} - {{- range . }} + {{- range . }} - {{- end }} + {{- 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 }} + {{- 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 }} {{- end }} + {{- end }} {{- end }} {{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}} @@ -107,7 +110,7 @@ {{- $facebookAdmin = . }} {{- $hugoVersion := "0.120.0" }} {{- if ge hugo.Version $hugoVersion }} - {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }} + {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }} {{- end }} {{- end }} {{- end }} diff --git a/layouts/partials/twitter_cards.html b/layouts/partials/twitter_cards.html index 59f2180255..4a33fc6bcb 100644 --- a/layouts/partials/twitter_cards.html +++ b/layouts/partials/twitter_cards.html @@ -4,13 +4,13 @@ {{- $page := . }} {{- $title := .Title }} {{- if eq $outputFormat "searchpage" }} - {{- $title = T "Search" }} + {{- $title = T "Search" }} {{- else if eq .Kind "taxonomy" }} - {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} + {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} {{- else if eq .Kind "term" }} - {{- $taxonomy_page := .Site.GetPage .Data.Plural }} - {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} - {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} + {{- $taxonomy_page := .Site.GetPage .Data.Plural }} + {{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }} {{- end }} {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} @@ -19,22 +19,22 @@ {{- else }} - {{- $images := $.Resources.ByType "image" }} - {{- $featured := $images.GetMatch "*feature*" }} - {{- if not $featured }} - {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} - {{- end }} - {{- with $featured }} + {{- $images := $.Resources.ByType "image" }} + {{- $featured := $images.GetMatch "*feature*" }} + {{- if not $featured }} + {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} + {{- end }} + {{- with $featured }} - {{- else }} - {{- with $.Site.Params.images }} + {{- else }} + {{- with $.Site.Params.images }} - {{- else }} + {{- else }} - {{- end }} {{- end }} + {{- end }} {{- end }}