|
| 1 | +<meta property="og:title" content="{{ .Title }}" /> |
| 2 | +<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> |
| 3 | +<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> |
| 4 | +<meta property="og:url" content="{{ .Permalink }}" /> |
| 5 | +{{- if .Params.cover.image -}} |
| 6 | +{{- if (ne .Params.cover.relative true) }} |
| 7 | +<meta property="og:image" content="{{ .Params.cover.image | absURL }}" /> |
| 8 | +{{- else}} |
| 9 | +<meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" /> |
| 10 | +{{- end}} |
| 11 | +{{- else }} |
| 12 | + |
| 13 | +{{- with $.Params.images -}} |
| 14 | +{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}} |
| 15 | +{{- else -}} |
| 16 | +{{- $images := $.Resources.ByType "image" -}} |
| 17 | +{{- $featured := $images.GetMatch "*feature*" -}} |
| 18 | +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} |
| 19 | +{{- with $featured -}} |
| 20 | +<meta property="og:image" content="{{ $featured.Permalink }}"/> |
| 21 | +{{- else -}} |
| 22 | +{{- with site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} |
| 23 | +{{- end -}} |
| 24 | +{{- end -}} |
| 25 | +{{- end }} |
| 26 | + |
| 27 | +{{- if .IsPage }} |
| 28 | +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} |
| 29 | +<meta property="article:section" content="{{ .Section }}" /> |
| 30 | +{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} |
| 31 | +{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} |
| 32 | +{{- end -}} |
| 33 | + |
| 34 | +{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} |
| 35 | +{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} |
| 36 | +{{- with site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} |
| 37 | +{{- with .Params.videos }}{{- range . }} |
| 38 | +<meta property="og:video" content="{{ . | absURL }}" /> |
| 39 | +{{ end }}{{ end }} |
| 40 | + |
| 41 | +{{- /* If it is part of a series, link to related articles */}} |
| 42 | +{{- $permalink := .Permalink }} |
| 43 | +{{- $siteSeries := site.Taxonomies.series }} |
| 44 | +{{ with .Params.series }}{{- range $name := . }} |
| 45 | + {{- $series := index $siteSeries ($name | urlize) }} |
| 46 | + {{- range $page := first 6 $series.Pages }} |
| 47 | + {{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} |
| 48 | + {{- end }} |
| 49 | +{{ end }}{{ end }} |
| 50 | + |
| 51 | +{{- /* Facebook Page Admin ID for Domain Insights */}} |
| 52 | +{{- with site.Params.social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} |
0 commit comments