mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
tpl/tplimpl: Deprecate .Site.Social usage with internal templates
This commit is contained in:
parent
1b5f78b6b7
commit
4910312ee7
3 changed files with 30 additions and 7 deletions
|
@ -184,11 +184,11 @@ If no images are found at all, then an image-less Twitter `summary` card is used
|
|||
|
||||
Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.
|
||||
|
||||
The `.Site.Social.twitter` variable is exposed from the configuration as the value for `twitter:site`.
|
||||
Set the value of `twitter:site` in your site configuration:
|
||||
|
||||
{{< code-toggle file="hugo" >}}
|
||||
[social]
|
||||
twitter = "GoHugoIO"
|
||||
{{< code-toggle file="hugo" copy=false >}}
|
||||
[params.social]
|
||||
twitter = "GoHugoIO"
|
||||
{{</ code-toggle >}}
|
||||
|
||||
NOTE: The `@` will be added for you
|
||||
|
|
|
@ -42,5 +42,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 }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
|
|
|
@ -19,6 +19,18 @@
|
|||
{{- 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 -}}"/>
|
||||
{{ 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="@{{ . }}"/>
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
|
|
Loading…
Reference in a new issue