diff --git a/layouts/partials/jsonld/article.html b/layouts/partials/jsonld/article.html new file mode 100644 index 00000000..1c3b148e --- /dev/null +++ b/layouts/partials/jsonld/article.html @@ -0,0 +1,49 @@ +{{ $page := .page }} +{{ $summary := .summary }} +{{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }} + +{{/* Get microdata type. */}} +{{ $microdata_type := "Article" }} +{{ if eq $page.Type "post" }} + {{ $microdata_type = "BlogPosting" }} +{{ end }} + +{{/* Get author name. */}} +{{ $author_username := "" }} +{{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }} + {{ $author_username = $page.Scratch.Get "superuser_username" }} +{{ else if $page.Params.authors }} + {{ $author_username = index $page.Params.authors 0 }} +{{ end }} +{{ $author := "" }} +{{ $taxonomy := "authors" }} +{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }} +{{ with $profile_page }} + {{ $author = .Params.name | default .Title }} +{{ end }} + + diff --git a/layouts/partials/jsonld/main.html b/layouts/partials/jsonld/main.html new file mode 100644 index 00000000..0d8f0d36 --- /dev/null +++ b/layouts/partials/jsonld/main.html @@ -0,0 +1,14 @@ +{{ $page := .page }} +{{ $summary := .summary }} + +{{- if $page.IsHome -}} + + {{ partial "jsonld/website.html" $page }} + +{{- else if $page.IsPage -}} + + {{ if or (eq $page.Type "post") (eq $page.Type "publication") }} + {{ partial "jsonld/article.html" (dict "page" $page "summary" $summary) }} + {{ end }} + +{{- end }} diff --git a/layouts/partials/jsonld/website.html b/layouts/partials/jsonld/website.html new file mode 100644 index 00000000..61c7a2bc --- /dev/null +++ b/layouts/partials/jsonld/website.html @@ -0,0 +1,14 @@ + diff --git a/layouts/partials/site_head.html b/layouts/partials/site_head.html index 30ffa17e..3af5023c 100644 --- a/layouts/partials/site_head.html +++ b/layouts/partials/site_head.html @@ -189,6 +189,8 @@ {{ if not .Date.IsZero }}{{ end }} {{ end }} + {{ partial "jsonld/main" (dict "page" . "summary" $desc) }} + {{ partial "cookie_consent" . }} {{ partial "custom_head" . }}