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