diff options
author | Caio Lente <7017340+clente@users.noreply.github.com> | 2024-01-04 19:37:50 -0300 |
---|---|---|
committer | Caio Lente <7017340+clente@users.noreply.github.com> | 2024-01-04 19:37:50 -0300 |
commit | f0643ea03875393d30f44fba235de145eb71bbdb (patch) | |
tree | 0b1cc22eac9fc688a7a4e5861c5a1998a3d5cede /layouts/partials/social_card.html | |
parent | 488fcc401fa605a5d79fbf98754556de2cf09d18 (diff) | |
parent | bd5d81f18c0fdb9be3506af5a984cac64fae81f2 (diff) | |
download | hugo-bearcub-f0643ea03875393d30f44fba235de145eb71bbdb.tar.gz hugo-bearcub-f0643ea03875393d30f44fba235de145eb71bbdb.tar.bz2 |
Merge branch 'main' into style/herman
Diffstat (limited to 'layouts/partials/social_card.html')
-rw-r--r-- | layouts/partials/social_card.html | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/layouts/partials/social_card.html b/layouts/partials/social_card.html index 75c3c9a..6faacc0 100644 --- a/layouts/partials/social_card.html +++ b/layouts/partials/social_card.html @@ -13,7 +13,7 @@ )) }} {{ $date := .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }} -{{ $author := (default $.Site.Author.name ($.Param "author") ) }} +{{ $author := (default $.Site.Params.author.name ($.Param "author") ) }} {{ $byline := (printf "%s | %s" $author $date) }} {{ $fg = $fg.Filter (images.Text $byline (dict @@ -29,7 +29,7 @@ {{ $card := $card.Resize "900x webp q100" }} <!-- Open Graph / Facebook --> -<!-- Source: https://raw.githubusercontent.com/gohugoio/hugo/master/tpl/tplimpl/embedded/templates/opengraph.html --> +<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html --> <meta property="og:title" content="{{ .Title }}" /> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> @@ -63,22 +63,52 @@ {{ end }}{{ end }} {{- end }} +{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}} +{{- $facebookAdmin := "" }} +{{- with site.Params.social }} + {{- if reflect.IsMap . }} + {{- $facebookAdmin = .facebook_admin }} + {{- end }} +{{- else }} + {{- with site.Social.facebook_admin }} + {{- $facebookAdmin = . }} + {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }} + {{- end }} +{{- end }} + {{- /* Facebook Page Admin ID for Domain Insights */}} -{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} +{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} <!-- Twitter --> <!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/twitter_cards.html --> <meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:image" content="{{ $card.Permalink | absURL }}"/> - <meta name="twitter:title" content="{{ .Title }}"/> <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> -{{ with .Site.Social.twitter -}} -<meta name="twitter:site" content="@{{ . }}"/> -{{ end -}} + +{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}} +{{- $twitterSite := "" }} +{{- with site.Params.social }} + {{- if reflect.IsMap . }} + {{- $twitterSite = .twitter }} + {{- end }} +{{- else }} + {{- with site.Social.twitter }} + {{- $twitterSite = . }} + {{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }} + {{- end }} +{{- end }} + +{{- with $twitterSite }} + {{- $content := . }} + {{- if not (strings.HasPrefix . "@") }} + {{- $content = printf "@%v" $twitterSite }} + {{- end }} +<meta name="twitter:site" content="{{ $content }}"/> +{{- end }} <!-- Microdata --> -<!-- Source: https://raw.githubusercontent.com/gohugoio/hugo/master/tpl/tplimpl/embedded/templates/schema.html --> +<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/schema.html --> <meta itemprop="name" content="{{ .Title }}"> <meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> |