summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--exampleSite/content/about.md1
-rw-r--r--layouts/partials/schema.org/article.html41
3 files changed, 24 insertions, 20 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f21a467..5aab30d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Provide template to render pure JSON of the site contents.
- Provide search feature.
+- Provide ability to specify semantic page type in Front Matter
+ (will be used for Schema.org)
### Changed
diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md
index b624677..940879f 100644
--- a/exampleSite/content/about.md
+++ b/exampleSite/content/about.md
@@ -1,6 +1,7 @@
---
title: About
caption: Hello!
+semanticType: about
---
One of our most pressing and ever-evolving needs as scholars is to pass on our textual artifacts
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": {