File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
themes/devopsdays-theme/layouts/partials Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change 6363 {{- /* Default for non-event pages */ -}}
6464 {{- $shares = slice "email" (dict "share" "twitter" "via" ($.Scratch.Get "twitter_handle")) "facebook" "linkedin" -}}
6565{{- end -}}
66- {{- $shares_js := "" -}}
67- {{- $first := true -}}
66+ {{- $shares_js_parts := slice -}}
6867{{- range $shares -}}
69- {{- if not $first -}}
70- {{- $shares_js = printf "%s, " $shares_js -}}
71- {{- end -}}
72- {{- $is_twitter := false -}}
73- {{- $share_val := "" -}}
74- {{- if isset . "share" -}}
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") -}}
68+ {{- $share_str := "" -}}
69+ {{- $share_type := "" -}}
70+ {{- $share_via := "" -}}
71+ {{- with .share -}}
72+ {{- $share_type = . -}}
73+ {{- $share_via = ($.Scratch.Get "twitter_handle") -}}
74+ {{- $share_str = printf "{share: \"%s\", via: '%s'}" $share_type $share_via -}}
8075 {{- else -}}
81- {{- $shares_js = printf "%s\"%s\"" $shares_js . -}}
76+ {{- $share_str = printf "\"%s\"" . -}}
77+ {{- end -}}
78+ {{- if $share_str -}}
79+ {{- $shares_js_parts = $shares_js_parts | append $share_str -}}
8280 {{- end -}}
83- {{- $first = false -}}
8481{{- end -}}
85- {{- $.Scratch.Set "shares_js" $shares_js -}}
82+ {{- $shares_js_str := delimit $shares_js_parts ", " -}}
83+ {{- $.Scratch.Set "shares_js" $shares_js_str -}}
8684
8785< script >
8886//shares
You can’t perform that action at this time.
0 commit comments