opengraph.html (2181B)
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
6 {{- with $.Params.images -}}
7 {{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
8 {{- else -}}
9 {{- $featured := partial "opengraph/get-featured-image.html" . }}
10 {{- with $featured -}}
11 <meta property="og:image" content="{{ $featured.Permalink }}"/>
12 {{- else -}}
13 {{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
14 {{- end -}}
15 {{- end -}}
16
17 {{- if .IsPage }}
18 {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
19 <meta property="article:section" content="{{ .Section }}" />
20 {{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
21 {{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
22 {{- end -}}
23
24 {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
25 {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
26 {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
27 {{- with .Params.videos }}{{- range . }}
28 <meta property="og:video" content="{{ . | absURL }}" />
29 {{ end }}{{ end }}
30
31 {{- /* If it is part of a series, link to related articles */}}
32 {{- $permalink := .Permalink }}
33 {{- $siteSeries := .Site.Taxonomies.series }}
34 {{ with .Params.series }}{{- range $name := . }}
35 {{- $series := index $siteSeries ($name | urlize) }}
36 {{- range $page := first 6 $series.Pages }}
37 {{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
38 {{- end }}
39 {{ end }}{{ end }}
40
41 {{- /* Facebook Page Admin ID for Domain Insights */}}
42 {{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}