diff options
Diffstat (limited to 'themes/PaperMod/layouts/partials/templates/opengraph.html')
-rw-r--r-- | themes/PaperMod/layouts/partials/templates/opengraph.html | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/themes/PaperMod/layouts/partials/templates/opengraph.html b/themes/PaperMod/layouts/partials/templates/opengraph.html index 9e8df14..95f037c 100644 --- a/themes/PaperMod/layouts/partials/templates/opengraph.html +++ b/themes/PaperMod/layouts/partials/templates/opengraph.html @@ -10,18 +10,10 @@ {{- end}} {{- else }} -{{- with $.Params.images -}} -{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}} -{{- else -}} -{{- $images := $.Resources.ByType "image" -}} -{{- $featured := $images.GetMatch "*feature*" -}} -{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} -{{- with $featured -}} -<meta property="og:image" content="{{ $featured.Permalink }}"/> -{{- else -}} -{{- with site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} -{{- end -}} -{{- end -}} +{{- $images := partial "partials/templates/_funcs/get-page-images" . -}} +{{- range first 6 $images }} +<meta property="og:image" content="{{ .Permalink }}" /> +{{ end -}} {{- end }} {{- if .IsPage }} @@ -41,12 +33,27 @@ {{- /* 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 }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} {{- end }} {{ 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 }} |