twitter_cards.html (1096B)
1 {{- with $.Params.images -}} 2 <meta name="twitter:card" content="summary_large_image"/> 3 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 4 {{ else -}} 5 {{- $images := $.Resources.ByType "image" -}} 6 {{- $featured := $images.GetMatch "*feature*" -}} 7 {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} 8 {{- with $featured -}} 9 <meta name="twitter:card" content="summary_large_image"/> 10 <meta name="twitter:image" content="{{ $featured.Permalink }}"/> 11 {{- else -}} 12 {{- with $.Site.Params.images -}} 13 <meta name="twitter:card" content="summary_large_image"/> 14 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 15 {{ else -}} 16 <meta name="twitter:card" content="summary"/> 17 {{- end -}} 18 {{- end -}} 19 {{- end }} 20 <meta name="twitter:title" content="{{ .Title }}"/> 21 <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> 22 {{ with .Site.Social.twitter -}} 23 <meta name="twitter:site" content="@{{ . }}"/> 24 {{ end -}}