From e8614d96f44c290224ae65a2dd029acdff1d3c74 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 5 Jun 2022 14:50:21 +0200 Subject: Provided initial support os schema.org microdata --- layouts/partials/head.html | 1 + layouts/partials/schema.org/article.html | 65 +++++++++++++++++++++++++++++ layouts/partials/schema.org/website.html | 10 +++++ layouts/partials/templates/schema_json.html | 5 +++ 4 files changed, 81 insertions(+) create mode 100644 layouts/partials/schema.org/article.html create mode 100644 layouts/partials/schema.org/website.html create mode 100644 layouts/partials/templates/schema_json.html (limited to 'layouts/partials') diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 39e3255..00a5f82 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -33,4 +33,5 @@ {{- /* Misc */}} {{ template "partials/templates/opengraph.html" . }} {{ template "partials/templates/twitter_cards.html" . }} + {{ template "partials/templates/schema_json.html" . }} diff --git a/layouts/partials/schema.org/article.html b/layouts/partials/schema.org/article.html new file mode 100644 index 0000000..ff1558b --- /dev/null +++ b/layouts/partials/schema.org/article.html @@ -0,0 +1,65 @@ +{{- /* Get schema type. */}} +{{ $schemaType := "Article" }} +{{ if or (eq .Type "post") (eq .Type "posts") }} + {{ $schemaType = "BlogPosting" }} +{{ end -}} + +{{- $publisher := site.Params.seo.publisher | default site.Title }} +{{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }} +{{ $logo = $logo.Resize "96x96" -}} + + + + diff --git a/layouts/partials/schema.org/website.html b/layouts/partials/schema.org/website.html new file mode 100644 index 0000000..ef6609e --- /dev/null +++ b/layouts/partials/schema.org/website.html @@ -0,0 +1,10 @@ + +{{- /* TODO: Add "potentialAction" with search. + For more see: https://developers.google.com/structured-data/slsb-overview */ -}} diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html new file mode 100644 index 0000000..aaed1e2 --- /dev/null +++ b/layouts/partials/templates/schema_json.html @@ -0,0 +1,5 @@ +{{ if .IsHome }} + {{ partial "schema.org/website.html" . }} +{{ else if and .IsPage (ne .Params.private true) }} + {{ partial "schema.org/article.html" . }} +{{ end }} -- cgit v1.2.3