{{- /*
Extends Hugo's embedded twitter_cards partial:
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_partials/twitter_cards.html
Key differences:
- Generates twitter:site / twitter:creator from site params (.Site.Params.social.twitter)
- The param can be a string or a map; when it's a map, reads creator/id
*/ -}}
{{- $images := partial "_funcs/get-page-images" . }}
{{- with index $images 0 }}
{{- else }}
{{- end }}
{{- with or .Title site.Title site.Params.title | plainify }}
{{- end }}
{{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
{{- end }}
{{- with site.Params.social.twitter -}}
{{- $site := "" -}}
{{- $creator := "" -}}
{{- if reflect.IsMap . -}}
{{- $creator = .creator | default .id -}}
{{- $site = .site | default $creator -}}
{{- else -}}
{{- $creator = . -}}
{{- end -}}
{{- with $site -}}
{{- end -}}
{{- with $creator -}}
{{- end -}}
{{- end -}}