Files
website/layouts/partials/share-render.html
Andrew Stryker 421ec655e9 Move from "social" to "share"
The theme uses `.Site.Params.social` for Twitter Cards and possible other
things. To avoid the name clash, this change places configuration under
`.Site.Params.share` and `xparams.share`.
2025-03-10 21:36:21 -07:00

28 lines
1.0 KiB
HTML

{{- /* layouts/partials/share-render.html */ -}}
{{- $parent := . -}}
{{- $platforms := .platforms -}}
{{- $ctx := .context -}}
{{- if gt (len $platforms) 0 -}}
<div class="social-sharing">
{{- range $platformName := $platforms -}}
{{- $cfg := index $ctx.Site.Params.share $platformName | default dict -}}
{{- /* Merge dynamic elements with the explicit configuration */ -}}
{{- $merged := merge
(dict
"pageTitle" $ctx.Title
"pagePermalink" $ctx.Permalink
"platform" $platformName
)
$cfg
-}}
{{- $partialName := printf "share-platform-%s.html" $platformName -}}
{{- if templates.Exists (printf "partials/%s" $partialName) -}}
{{- partial $partialName $merged -}}
{{- else -}}
{{- partial "share-platform-generic.html" $merged -}}
{{- end -}}
{{- end -}}
{{ partialCached "share-style" "share-style.html" "share-style" }}
</div>
{{- end -}}