[PATCH] hugolib: Deprecate site methods Author, Authors, and Social
cherry-picked from gohugoio/hugo@d4d49e0
This commit is contained in:
parent
696579255a
commit
65bd711a3b
|
@ -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 }}
|
||||
<meta property="fb:admins" content="{{ . }}" />
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Facebook Page Admin ID for Domain Insights */}}
|
||||
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
|
|
|
@ -16,23 +16,16 @@
|
|||
{{- end }}
|
||||
<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 -}}"/>
|
||||
{{- /* 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." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $twitterSite }}
|
||||
{{- with .twitter }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" $twitterSite }}
|
||||
{{- $content = printf "@%v" . }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}"/>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
Loading…
Reference in New Issue