[PATCH] tpl/tplimpl: Deprecate .Site.Social usage with internal templates

cherry-picked from 4910312ee7
This commit is contained in:
Joe Mooring 2023-11-04 15:05:42 +05:30 committed by Aditya Telange
parent 102e089bc3
commit 3fb112bc85
2 changed files with 25 additions and 3 deletions

View File

@ -50,5 +50,16 @@
{{ end }}{{ end }} {{ end }}{{ 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 */}} {{- /* 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 }}

View File

@ -28,6 +28,17 @@
{{- end }} {{- end }}
<meta name="twitter:title" content="{{ .Title }}"/> <meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ 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 }}
<meta name="twitter:site" content="@{{ . }}"/> <meta name="twitter:site" content="@{{ . }}"/>
{{ end -}} {{- end }}