summaryrefslogtreecommitdiffstats
path: root/layouts/partials
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-13 00:13:38 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-13 00:13:38 +0200
commit426446f77ef673689f9b2b074620595a79b3fb19 (patch)
treeb095cd5c49ab1c3d68bb61865f51be176e00f959 /layouts/partials
parentcad2f67c2f98dd6fe15c402de1bf6c1801bd30dc (diff)
downloadgohugo-theme-ed-426446f77ef673689f9b2b074620595a79b3fb19.tar.gz
Provide ability to specify semantic page type in Front Matter
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/schema.org/article.html41
1 files changed, 21 insertions, 20 deletions
diff --git a/layouts/partials/schema.org/article.html b/layouts/partials/schema.org/article.html
index 05c8358..0c47dc8 100644
--- a/layouts/partials/schema.org/article.html
+++ b/layouts/partials/schema.org/article.html
@@ -1,6 +1,9 @@
{{- /* Get schema type. */}}
{{- $schemaType := "Article" -}}
-{{- if or (eq .Type "post") (eq .Type "posts") -}}
+
+{{- if (eq .Params.semanticType "about") -}}
+ {{- $schemaType = "AboutPage" -}}
+{{- else if or (eq .Type "post") (eq .Type "posts") -}}
{{- $schemaType = "BlogPosting" -}}
{{- end -}}
@@ -25,30 +28,28 @@
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
{{- if .Params.author }}
- {{- $authorType := (printf "%T" .Params.author) }}
+ {{- $authorType := (printf "%T" .Params.author) -}}
{{- if eq $authorType "string" }}
- "author": {
- "@type": "Person",
- "name": {{ .Params.author }}
- },
+ "author": {
+ "@type": "Person",
+ "name": {{ .Params.author }}
+ },
{{- else if eq $authorType "[]string" }}
- "author": [
- {{ range $i, $author := .Params.author }}{{ if $i }},{{ end }}
- {
- "@type": "Person",
- "name": {{ $author }}
- }{{ end }}
- ],
+ "author": [
+ {{ range $i, $author := .Params.author }}{{ if $i }},{{ end }}
+ {
+ "@type": "Person",
+ "name": {{ $author }}
+ }{{ end }}
+ ],
{{- end }}
{{- else }}
{{- with site.Author.name }}
- "author": {
- "@type": "Person",
- "name": {{ . }}
- {{ with site.Author.twitter }},
- "url": "https://twitter.com/{{ . }}"
- {{ end }}
- },
+ "author": {
+ "@type": "Person",
+ "name": {{ . }}{{ with site.Author.twitter }},
+ "url": "https://twitter.com/{{ . }}"{{ end }}
+ },
{{- end }}
{{- end }}
"publisher": {