summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Mooring <joe.mooring@veriphor.com>2023-11-01 08:31:15 -0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-11-01 17:42:45 +0100
commitcb98e9061b3d62b6f1e635a6cf9a8be57dc3f56c (patch)
tree178212bad8fa5ff74532f70dbc3039550becc4fe
parent5fa97ee964d037e636f56aa2b03aefe3862f5ed1 (diff)
tpl/tplimpl: Fix deprecation logic in embedded templates
Closes #11658
-rw-r--r--tpl/tplimpl/embedded/templates/opengraph.html6
-rw-r--r--tpl/tplimpl/embedded/templates/twitter_cards.html12
2 files changed, 13 insertions, 5 deletions
diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html
index f5a4ebd9f..f62ff474e 100644
--- a/tpl/tplimpl/embedded/templates/opengraph.html
+++ b/tpl/tplimpl/embedded/templates/opengraph.html
@@ -44,8 +44,10 @@
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
{{- $facebookAdmin := "" }}
-{{- with site.Params.social.facebook_admin }}
- {{- $facebookAdmin = . }}
+{{- with site.Params.social }}
+ {{- if reflect.IsMap . }}
+ {{- $facebookAdmin = .facebook_admin }}
+ {{- end }}
{{- else }}
{{- with site.Social.facebook_admin }}
{{- $facebookAdmin = . }}
diff --git a/tpl/tplimpl/embedded/templates/twitter_cards.html b/tpl/tplimpl/embedded/templates/twitter_cards.html
index 4a753bba6..f9f6f10b0 100644
--- a/tpl/tplimpl/embedded/templates/twitter_cards.html
+++ b/tpl/tplimpl/embedded/templates/twitter_cards.html
@@ -22,8 +22,10 @@
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
{{- $twitterSite := "" }}
-{{- with site.Params.social.twitter }}
- {{- $twitterSite = . }}
+{{- with site.Params.social }}
+ {{- if reflect.IsMap . }}
+ {{- $twitterSite = .twitter }}
+ {{- end }}
{{- else }}
{{- with site.Social.twitter }}
{{- $twitterSite = . }}
@@ -32,5 +34,9 @@
{{- end }}
{{- with $twitterSite }}
-<meta name="twitter:site" content="@{{ . }}"/>
+ {{- $content := . }}
+ {{- if not (strings.HasPrefix . "@") }}
+ {{- $content = printf "@%v" $twitterSite }}
+ {{- end }}
+<meta name="twitter:site" content="{{ $content }}"/>
{{- end }}