Files
website/layouts/partials/share-platform-defaults.html
T
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

24 lines
825 B
HTML

{{- /* layouts/partials/share-platform-defaults.html */ -}}
{{- $raw := .Site.Params.share | default (slice) -}}
{{- $defaults := slice -}}
{{- if reflect.IsSlice $raw -}}
{{- /* If .Site.Params.share is a slice, iterate over items */ -}}
{{- range $item := $raw -}}
{{- if eq (printf "%T" $item) "string" -}}
{{- $defaults = $defaults | append $item -}}
{{- else -}}
{{- /* If the item is a map, extract its "platform" key */ -}}
{{- $defaults = $defaults | append $item.platform -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- /* If .Site.Params.share is a map, iterate over keys */ -}}
{{- range $platform, $settings := $raw -}}
{{- if $settings.include -}}
{{- $defaults = $defaults | append $platform -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $defaults -}}