From 3fb112bc851ae88d7457300a262c7a30a7522454 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 4 Nov 2023 15:05:42 +0530 Subject: [PATCH] [PATCH] tpl/tplimpl: Deprecate .Site.Social usage with internal templates cherry-picked from https://github.com/gohugoio/hugo/commit/4910312ee75a1c67fad68c259ad9576dca854c62 --- layouts/partials/templates/opengraph.html | 13 ++++++++++++- layouts/partials/templates/twitter_cards.html | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 631dda14..b7fe84c7 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -50,5 +50,16 @@ {{ end }}{{ end }} {{- end }} +{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}} +{{- $facebookAdmin := "" }} +{{- with site.Params.social.facebook_admin }} + {{- $facebookAdmin = . }} +{{- 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 }}{{ end }} +{{ with $facebookAdmin }}{{ end }} diff --git a/layouts/partials/templates/twitter_cards.html b/layouts/partials/templates/twitter_cards.html index bd46e376..bdb59239 100644 --- a/layouts/partials/templates/twitter_cards.html +++ b/layouts/partials/templates/twitter_cards.html @@ -28,6 +28,17 @@ {{- end }} -{{ with site.Social.twitter -}} +{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}} +{{- $twitterSite := "" }} +{{- with site.Params.social.twitter }} + {{- $twitterSite = . }} +{{- else }} + {{- with site.Social.twitter }} + {{- $twitterSite = . }} + {{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }} + {{- end }} +{{- end }} + +{{- with $twitterSite }} -{{ end -}} +{{- end }}