schema.html (1463B)
1 <meta itemprop="name" content="{{ .Title }}">
2 <meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
3
4 {{- if .IsPage -}}
5 {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
6 {{ with .PublishDate }}<meta itemprop="datePublished" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}}
7 {{ with .Lastmod }}<meta itemprop="dateModified" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}}
8 <meta itemprop="wordCount" content="{{ .WordCount }}">
9
10 {{- with $.Params.images -}}
11 {{- range first 6 . -}}<meta itemprop="image" content="{{ . | absURL }}">{{ end -}}
12 {{- else -}}
13 {{- $images := $.Resources.ByType "image" -}}
14 {{- $featured := $images.GetMatch "*feature*" -}}
15 {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
16 {{- with $featured -}}
17 <meta itemprop="image" content="{{ $featured.Permalink }}">
18 {{- else -}}
19 {{- with $.Site.Params.images -}}<meta itemprop="image" content="{{ index . 0 | absURL }}"/>{{ end -}}
20 {{- end -}}
21 {{- end -}}
22
23 <!-- Output all taxonomies as schema.org keywords -->
24 <meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
25 {{- end -}}