Skip to content

Commit cb98e90

Browse files
jmooringbep
authored andcommitted
tpl/tplimpl: Fix deprecation logic in embedded templates
Closes #11658
1 parent 5fa97ee commit cb98e90

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

tpl/tplimpl/embedded/templates/opengraph.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444

4545
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
4646
{{- $facebookAdmin := "" }}
47-
{{- with site.Params.social.facebook_admin }}
48-
{{- $facebookAdmin = . }}
47+
{{- with site.Params.social }}
48+
{{- if reflect.IsMap . }}
49+
{{- $facebookAdmin = .facebook_admin }}
50+
{{- end }}
4951
{{- else }}
5052
{{- with site.Social.facebook_admin }}
5153
{{- $facebookAdmin = . }}

tpl/tplimpl/embedded/templates/twitter_cards.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
2424
{{- $twitterSite := "" }}
25-
{{- with site.Params.social.twitter }}
26-
{{- $twitterSite = . }}
25+
{{- with site.Params.social }}
26+
{{- if reflect.IsMap . }}
27+
{{- $twitterSite = .twitter }}
28+
{{- end }}
2729
{{- else }}
2830
{{- with site.Social.twitter }}
2931
{{- $twitterSite = . }}
@@ -32,5 +34,9 @@
3234
{{- end }}
3335

3436
{{- with $twitterSite }}
35-
<meta name="twitter:site" content="@{{ . }}"/>
37+
{{- $content := . }}
38+
{{- if not (strings.HasPrefix . "@") }}
39+
{{- $content = printf "@%v" $twitterSite }}
40+
{{- end }}
41+
<meta name="twitter:site" content="{{ $content }}"/>
3642
{{- end }}

0 commit comments

Comments
 (0)