22 lines
752 B
HTML
Executable File
22 lines
752 B
HTML
Executable File
{{- $title := .Title | default .Site.Title -}}
|
|
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
|
{{- $image := .Params.image | default "/images/og-default.png" -}}
|
|
{{- if not (strings.HasPrefix $image "http") -}}
|
|
{{- $image = $image | absURL -}}
|
|
{{- end -}}
|
|
|
|
{{/* Determine card type */}}
|
|
{{- $cardType := "summary" -}}
|
|
{{- if $image -}}
|
|
{{- $cardType = "summary_large_image" -}}
|
|
{{- end -}}
|
|
|
|
<meta name="twitter:card" content="{{ $cardType }}">
|
|
<meta name="twitter:title" content="{{ $title }}">
|
|
<meta name="twitter:description" content="{{ $desc }}">
|
|
|
|
{{- if $image }}
|
|
<meta name="twitter:image" content="{{ $image }}">
|
|
<meta name="twitter:image:alt" content="{{ $title }}">
|
|
{{- end }}
|