hugo-theme-relearn/layouts/partials/twitter_cards.html
2024-10-11 16:45:40 +02:00

29 lines
No EOL
970 B
HTML

{{- /* based on Hugo 0.125.5 twitter_cards.html */}}
{{- $images := partial "_funcs/get-page-images" . }}
{{- with index $images 0 }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ .Permalink }}">
{{- else }}
<meta name="twitter:card" content="summary">
{{- end }}
{{- with partial "title.gotmpl" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
<meta name="twitter:title" content="{{ . }}">
{{- end }}
{{- with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}
<meta name="twitter:description" content="{{ . }}">
{{- end }}
{{- $twitterSite := "" }}
{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- with .twitter }}
{{- $content := . }}
{{- if not (strings.HasPrefix . "@") }}
{{- $content = printf "@%v" . }}
{{- end }}
<meta name="twitter:site" content="{{ $content }}"/>
{{- end }}
{{- end }}
{{- end }}