Debian Codegraph @

tpl/tplimpl/embedded/templates/_partials/schema.html

raw
1 {{- with or .Title site.Title | plainify }}
2 <meta itemprop="name" content="{{ . }}">
3 {{- end }}
4
5 {{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
6 <meta itemprop="description" content="{{ trim . "\n\r\t " }}">
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.
34
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 . `,` }}">
56 {{- end -}}