|
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 |
| -{{- $images := partial "_funcs/get-page-images" . -}} |
11 |
| -{{- range first 6 $images -}} |
12 |
| - <meta itemprop="image" content="{{ .Permalink }}" /> |
13 |
| -{{- end -}} |
| 1 | +{{- with or .Title site.Title }} |
| 2 | + <meta itemprop="name" content="{{ . }}"> |
| 3 | +{{- end }} |
| 4 | + |
| 5 | +{{- with or .Description .Summary site.Params.Description }} |
| 6 | + <meta itemprop="description" content="{{ . }}"> |
| 7 | +{{- end }} |
| 8 | + |
| 9 | +{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }} |
| 10 | +{{- with .PublishDate }} |
| 11 | + <meta itemprop="datePublished" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}> |
| 12 | +{{- end }} |
| 13 | + |
| 14 | +{{- with .Lastmod }} |
| 15 | + <meta itemprop="dateModified" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}> |
| 16 | +{{- end }} |
| 17 | + |
| 18 | +{{- with .WordCount }} |
| 19 | + <meta itemprop="wordCount" content="{{ . }}"> |
| 20 | +{{- end }} |
| 21 | + |
| 22 | +{{- $images := partial "_funcs/get-page-images" . }} |
| 23 | +{{- range first 6 $images }} |
| 24 | + <meta itemprop="image" content="{{ .Permalink }}"> |
| 25 | +{{- end }} |
| 26 | + |
| 27 | +{{- /* |
| 28 | +Keywords precedence: |
| 29 | + |
| 30 | +1. Use "keywords" term page titles. |
| 31 | +2. Use "keywords" from front matter if "keywords" is not a taxonomy. |
| 32 | +3. Use "tags" term page titles. |
| 33 | +4. Use term page titles from all taxonomies. |
14 | 34 |
|
15 |
| -<!-- Output all taxonomies as schema.org keywords --> |
16 |
| -<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 }}" /> |
| 35 | +*/}} |
| 36 | +{{- $keywords := slice }} |
| 37 | +{{- range .GetTerms "keywords" }} |
| 38 | + {{- $keywords = $keywords | append .Title }} |
| 39 | +{{- else }} |
| 40 | + {{- with .Keywords }} |
| 41 | + {{- $keywords = . }} |
| 42 | + {{- else }} |
| 43 | + {{- range .GetTerms "tags" }} |
| 44 | + {{- $keywords = $keywords | append .Title }} |
| 45 | + {{- else }} |
| 46 | + {{- range $taxonomy, $_ := site.Taxonomies }} |
| 47 | + {{- range $.GetTerms $taxonomy }} |
| 48 | + {{- $keywords = $keywords | append .Title }} |
| 49 | + {{- end }} |
| 50 | + {{- end }} |
| 51 | + {{- end }} |
| 52 | + {{- end }} |
| 53 | +{{- end }} |
| 54 | +{{- with $keywords }} |
| 55 | + <meta itemprop="keywords" content="{{ delimit . `,` }}"> |
17 | 56 | {{- end -}}
|
0 commit comments