diff --git a/themes/neff/layouts/partials/head.html b/themes/neff/layouts/partials/head.html index 85221b3..0610198 100755 --- a/themes/neff/layouts/partials/head.html +++ b/themes/neff/layouts/partials/head.html @@ -1,8 +1,12 @@ {{- partial "schema/site.html" . -}} -{{- if (eq .Kind "page") -}} +{{- if (and (eq .Kind "page") (eq .Type "news")) -}} {{- partial "schema/post.html" . -}} {{- end -}} +{{- if (and (eq .Kind "page") (ne .Type "news")) -}} +{{- partial "schema/article.html" . -}} +{{- end -}} {{- if (eq .Kind "section") -}} +{{- partial "schema/collectionpage.html" . -}} {{- end -}} {{- $options := (dict "targetPath" "css/style.css" "outputStyle" "compressed") -}} {{- if .Site.IsServer -}} diff --git a/themes/neff/layouts/partials/img.html b/themes/neff/layouts/partials/img.html index 5e449ff..9722285 100644 --- a/themes/neff/layouts/partials/img.html +++ b/themes/neff/layouts/partials/img.html @@ -7,6 +7,7 @@ {{- with .ctx.Params.alt -}} {{- $alt = . -}} {{- end -}} +{{- $ctx := .ctx -}} {{ with .image }} {{ if eq $keep true }} {{ $alt }} {{ end }} +{{- partial "schema/img.html" (dict "image" . "ctx" $ctx) -}} {{ end }} \ No newline at end of file diff --git a/themes/neff/layouts/partials/schema/article.html b/themes/neff/layouts/partials/schema/article.html new file mode 100755 index 0000000..10a8557 --- /dev/null +++ b/themes/neff/layouts/partials/schema/article.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/themes/neff/layouts/partials/schema/article.jsonld b/themes/neff/layouts/partials/schema/article.jsonld new file mode 100755 index 0000000..b09754b --- /dev/null +++ b/themes/neff/layouts/partials/schema/article.jsonld @@ -0,0 +1,34 @@ +{{- $context := .ctx }} +{{- $post := .post }} +{ + "@context": "http://schema.org", + "@type": "Article", + "mainEntityOfPage": {{ partial "schema/site.jsonld" (dict "site" .ctx "ctx" .ctx "short" false) }}, + "articleSection": "{{ .post.Section }}", + "name": "{{ .post.Title }}", + "headline": "{{ .post.Title }}", + "description": "{{ with .post.Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}", + "inLanguage": "{{ .post.Lang }}", + "author": {{- range (first 1 (where .ctx.Site.Data.kontakt.kontakt ".address.addressLocality" "Niederkassel")) -}} + {{ partial "schema/organization.jsonld" (dict "org" . "ctx" $context "short" true) }} + {{- end -}}, + "creator": {{- range (first 1 (where .ctx.Site.Data.kontakt.kontakt ".address.addressLocality" "Niederkassel")) -}} + {{ partial "schema/organization.jsonld" (dict "org" . "ctx" $context "short" true) }} + {{- end -}}, + "publisher": {{- range (first 1 (where .ctx.Site.Data.kontakt.kontakt ".address.addressLocality" "Niederkassel")) -}} + {{ partial "schema/organization.jsonld" (dict "org" . "ctx" $context "short" true) }} + {{- end -}}, + "copyrightHolder": + {{- range (first 1 (where .ctx.Site.Data.kontakt.kontakt ".address.addressLocality" "Niederkassel")) -}} + {{ partial "schema/organization.jsonld" (dict "org" . "ctx" $context "short" true) }} + {{- end -}}, + "copyrightYear": "{{ .post.Date.Format "2006" }}", + "datePublished": "{{ .post.PublishDate | safeHTML }}", + "dateModified": "{{ .post.Lastmod | safeHTML }}", + "url": "{{ .post.Permalink }}", + "wordCount": "{{ .post.WordCount }}", + "keywords": "{{ with .post.Keywords }}{{ delimit . ", " }}{{ end }}", + {{ $imageURL := path.Join .post.RelPermalink "bilder/" .post.Params.featuredImage }} + "image": {{ partial "schema/image.jsonld" (dict "url" $imageURL "ctx" .ctx) }}, + "articleBody": {{ .ctx.Content | jsonify }} +} diff --git a/themes/neff/layouts/partials/schema/collectionpage.html b/themes/neff/layouts/partials/schema/collectionpage.html new file mode 100755 index 0000000..a521e60 --- /dev/null +++ b/themes/neff/layouts/partials/schema/collectionpage.html @@ -0,0 +1,3 @@ + diff --git a/themes/neff/layouts/partials/schema/collectionpage.jsonld b/themes/neff/layouts/partials/schema/collectionpage.jsonld new file mode 100644 index 0000000..a2a129f --- /dev/null +++ b/themes/neff/layouts/partials/schema/collectionpage.jsonld @@ -0,0 +1,21 @@ +{{- $context := .ctx -}} +{{- $list := .list -}} +{ + "@context":"http://schema.org/", + "@type":"CollectionPage", + "name":"{{ $list.Title }}", + "headline":"{{ $list.Title }}", + "mainEntityOfPage": {{ partial "schema/site.jsonld" (dict "site" .ctx "ctx" .ctx "short" false) }}, + "author": {{- range (first 1 (where .ctx.Site.Data.kontakt.kontakt ".address.addressLocality" "Niederkassel")) -}} + {{ partial "schema/organization.jsonld" (dict "org" . "ctx" $context "short" true) }} + {{- end -}}, + {{- with $list.Description }} + "description": "{{ . }}", + {{- end -}} + "hasPart": [ + {{- range $idx, $page := $list.Pages -}} + {{- if ne $idx 0 -}},{{- end -}} + {{ partial "schema/post.jsonld" (dict "post" $page "ctx" $context)}} + {{- end -}} + ] + } \ No newline at end of file diff --git a/themes/neff/layouts/partials/schema/img.html b/themes/neff/layouts/partials/schema/img.html new file mode 100755 index 0000000..022fa08 --- /dev/null +++ b/themes/neff/layouts/partials/schema/img.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/themes/neff/layouts/partials/schema/img.jsonld b/themes/neff/layouts/partials/schema/img.jsonld new file mode 100755 index 0000000..45926ac --- /dev/null +++ b/themes/neff/layouts/partials/schema/img.jsonld @@ -0,0 +1,9 @@ +{{- $context := .ctx -}} +{{- $site := .site -}} +{ + "@context": "http://schema.org", + "@type": "ImageObject", + "@id": {{ .image.Permalink | jsonify }}, + "url": {{ .image.Permalink | jsonify }}, + "caption": {{ .image.Params.alt | jsonify }} +} \ No newline at end of file diff --git a/themes/neff/layouts/partials/schema/post.jsonld b/themes/neff/layouts/partials/schema/post.jsonld index cb9c3ef..2c795cf 100755 --- a/themes/neff/layouts/partials/schema/post.jsonld +++ b/themes/neff/layouts/partials/schema/post.jsonld @@ -3,7 +3,7 @@ { "@context": "http://schema.org", "@type": "BlogPosting", - "mainEntityOfPage": {{ partial "schema/site.jsonld" (dict "site" .ctx "ctx" .ctx "short" true) }}, + "mainEntityOfPage": {{ partial "schema/site.jsonld" (dict "site" .ctx "ctx" .ctx "short" false) }}, "articleSection": "{{ .post.Section }}", "name": "{{ .post.Title }}", "headline": "{{ .post.Title }}",