Skip to content

Commit 3fb112b

Browse files
jmooringadityatelange
authored andcommitted
[PATCH] tpl/tplimpl: Deprecate .Site.Social usage with internal templates
cherry-picked from gohugoio/hugo@4910312
1 parent 102e089 commit 3fb112b

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

layouts/partials/templates/opengraph.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,16 @@
5050
{{ end }}{{ end }}
5151
{{- end }}
5252

53+
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
54+
{{- $facebookAdmin := "" }}
55+
{{- with site.Params.social.facebook_admin }}
56+
{{- $facebookAdmin = . }}
57+
{{- else }}
58+
{{- with site.Social.facebook_admin }}
59+
{{- $facebookAdmin = . }}
60+
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
61+
{{- end }}
62+
{{- end }}
63+
5364
{{- /* Facebook Page Admin ID for Domain Insights */}}
54-
{{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
65+
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}

layouts/partials/templates/twitter_cards.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
{{- end }}
2929
<meta name="twitter:title" content="{{ .Title }}"/>
3030
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
31-
{{ with site.Social.twitter -}}
31+
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
32+
{{- $twitterSite := "" }}
33+
{{- with site.Params.social.twitter }}
34+
{{- $twitterSite = . }}
35+
{{- else }}
36+
{{- with site.Social.twitter }}
37+
{{- $twitterSite = . }}
38+
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
39+
{{- end }}
40+
{{- end }}
41+
42+
{{- with $twitterSite }}
3243
<meta name="twitter:site" content="@{{ . }}"/>
33-
{{ end -}}
44+
{{- end }}

0 commit comments

Comments
 (0)