MitseaBlog/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/twitter.html

16 lines
799 B
HTML
Raw Normal View History

2022-10-11 17:34:41 +08:00
{{- with .Site.Params.opengraph.twitter.site -}}
<meta name="twitter:site" content="@{{ . }}">
<meta name="twitter:creator" content="@{{ . }}">
{{- end -}}
{{- $title := partialCached "data/title" . .RelPermalink -}}
{{- $description := partialCached "data/description" . .RelPermalink -}}
2024-07-31 17:10:56 +08:00
<meta name="twitter:title" {{ printf "content=%q" $title | safeHTMLAttr }}>
<meta name="twitter:description" {{ printf "content=%q" $description | safeHTMLAttr }}>
2022-10-11 17:34:41 +08:00
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
{{- if $image.exists -}}
<meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
{{- end -}}