]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl/tplimpl: Deprecate .Site.Social usage with internal templates
authorJoe Mooring <joe.mooring@veriphor.com>
Tue, 17 Oct 2023 00:43:11 +0000 (17:43 -0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 17 Oct 2023 18:04:24 +0000 (20:04 +0200)
docs/content/en/templates/internal.md
tpl/tplimpl/embedded/templates/opengraph.html
tpl/tplimpl/embedded/templates/twitter_cards.html

index ee0d7258db0a2ede049e3dd9bc765cccb8edf8b6..56315ec2c996b2d4f097431e9110c0f506203be0 100644 (file)
@@ -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
index a9d4dd83c5c46042fc2c8da5cdb92a3af291cfb9..f5a4ebd9f9d343cfb0fcf30dd5a0e7eb7702b500 100644 (file)
 {{ 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 }}
index 83a3b79c43cf678bc6138ca69e7803a0418f940a..4a753bba6dfdeb8af1306c9bc9ffa60e6b7208d5 100644 (file)
 {{- 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 }}