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`.
24 lines
825 B
HTML
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 -}}
|
|
|