From 65bd711a3baf2521f311f26d3dad46992aa853cf Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 12 Mar 2024 11:16:05 -0700 Subject: [PATCH] [PATCH] hugolib: Deprecate site methods Author, Authors, and Social cherry-picked from gohugoio/hugo@d4d49e0 --- layouts/partials/templates/opengraph.html | 15 ++++-------- layouts/partials/templates/twitter_cards.html | 23 +++++++------------ 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 95f037cc..fc922834 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -42,18 +42,11 @@ {{ end }}{{ end }} {{- end }} -{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}} -{{- $facebookAdmin := "" }} +{{- /* Facebook Page Admin ID for Domain Insights */}} {{- 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." }} + {{- with .facebook_admin }} + + {{- end }} {{- end }} {{- end }} - -{{- /* Facebook Page Admin ID for Domain Insights */}} -{{ with $facebookAdmin }}{{ end }} diff --git a/layouts/partials/templates/twitter_cards.html b/layouts/partials/templates/twitter_cards.html index 46b0d041..5d812f6a 100644 --- a/layouts/partials/templates/twitter_cards.html +++ b/layouts/partials/templates/twitter_cards.html @@ -16,23 +16,16 @@ {{- 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." }} + {{- with .twitter }} + {{- $content := . }} + {{- if not (strings.HasPrefix . "@") }} + {{- $content = printf "@%v" . }} + {{- end }} + + {{- end }} {{- end }} {{- end }} - -{{- with $twitterSite }} - {{- $content := . }} - {{- if not (strings.HasPrefix . "@") }} - {{- $content = printf "@%v" $twitterSite }} - {{- end }} - -{{- end }}