Skip to content

Commit e65948d

Browse files
committed
fix shares
1 parent 03c9aa0 commit e65948d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

themes/devopsdays-theme/layouts/partials/footer_scripts.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{{- end -}}
6060
{{- /* Build shares array as JavaScript string before script tag */ -}}
6161
{{- $shares := $.Scratch.Get "social_shares" -}}
62-
{{- if not $shares -}}
62+
{{- if or (not $shares) (eq (len $shares) 0) -}}
6363
{{- /* Default for non-event pages */ -}}
6464
{{- $shares = slice "email" (dict "share" "twitter" "via" ($.Scratch.Get "twitter_handle")) "facebook" "linkedin" -}}
6565
{{- end -}}
@@ -69,8 +69,14 @@
6969
{{- if not $first -}}
7070
{{- $shares_js = printf "%s, " $shares_js -}}
7171
{{- end -}}
72+
{{- $is_twitter := false -}}
73+
{{- $share_val := "" -}}
7274
{{- if isset . "share" -}}
73-
{{- $shares_js = printf "%s{share: \"%s\", via: '%s'}" $shares_js .share ($.Scratch.Get "twitter_handle") -}}
75+
{{- $is_twitter = true -}}
76+
{{- $share_val = .share -}}
77+
{{- end -}}
78+
{{- if $is_twitter -}}
79+
{{- $shares_js = printf "%s{share: \"%s\", via: '%s'}" $shares_js $share_val ($.Scratch.Get "twitter_handle") -}}
7480
{{- else -}}
7581
{{- $shares_js = printf "%s\"%s\"" $shares_js . -}}
7682
{{- end -}}

0 commit comments

Comments
 (0)