diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index e8f772e476..67172845ed 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -1,11 +1,10 @@ -{{- /* based on Hugo 0.119.0 _internal/opengraph.html but with modified title */}} +{{- /* based on Hugo 0.125.0 _internal/opengraph.html but with modified title */}} {{- $format := partial "get-format.hugo" . }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} {{- if eq $outputFormat "searchpage" }} {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} {{- end }} -{{- $page := . }} {{- $title := .Title }} {{- if eq $outputFormat "searchpage" }} {{- $title = T "Search" }} @@ -19,34 +18,24 @@ {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} {{- end }} - - - -{{- 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 $.Site.Params.images }} - - {{- end }} - {{- end }} + +{{- with or site.Title site.Params.title | plainify }} + +{{- end }} + + +{{- with or .Description .Summary site.Params.description | plainify }} + +{{- end }} + +{{- with or .Params.locale site.Language.LanguageCode site.Language.Lang }} + {{- end }} {{- if .IsPage }} - {{- $iso8601 := "2006-01-02T15:04:05-07:00" }} - {{- with .Parent }} - {{- $page := . }} - {{- $link := "" }} + + {{- with .FirstSection }} {{- $title := .Title }} {{- if eq $outputFormat "searchpage" }} {{- $title = T "Search" }} @@ -60,48 +49,57 @@ {{- if and $title .Site.Title (not (eq $title .Site.Title)) }} {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }} {{- end }} - + {{- end }} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" }} {{- with .PublishDate }} {{- end }} {{- with .Lastmod }} {{- end }} + {{- range .GetTerms "tags" | first 6 }} + + {{- end }} +{{- else }} + +{{- end }} + +{{- with partial "_funcs/get-page-images" . }} + {{- range . | first 6 }} + + {{- end }} {{- end }} {{- with .Params.audio }} - -{{- end }} -{{- with .Params.locale }} - -{{- end }} -{{- with .Site.Title }} - + {{- range . | first 6 }} + + {{- end }} {{- end }} + {{- with .Params.videos }} - {{- range . }} + {{- range . | first 6 }} {{- 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 }} +{{- range .GetTerms "series" }} + {{- range .Pages | first 7 }} + {{- if ne $ . }} + + {{- end }} + {{- end }} +{{- end }} + +{{- $facebookApp := "" }} +{{- with site.Params.social }} + {{- if reflect.IsMap . }} + {{- with .facebook_app_id }} + {{- $facebookApp = . }} {{- end }} {{- end }} {{- end }} -{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}} {{- $facebookAdmin := "" }} {{- with site.Params.social.facebook_admin }} {{- $facebookAdmin = . }} @@ -115,7 +113,10 @@ {{- end }} {{- end }} -{{- /* Facebook Page Admin ID for Domain Insights */}} -{{- with $facebookAdmin }} +{{- with $facebookApp }} + +{{- else }} + {{- with $facebookAdmin }} + {{- end }} {{- end }} \ No newline at end of file