From d5d805730ab82f5c3a794fc2303c02a87ccc60d1 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 15 Jun 2023 11:53:46 +0200 Subject: [PATCH] Schema structured data: toevoegen BreadcrumbList en aanvullen Organization --- config/_default/params.toml | 10 ++++++++ .../schemas/include-relevant-schemas.html | 2 ++ .../schemas/schema_BreadcrumbList.html | 24 +++++++++++++++++++ .../partials/schemas/schema_Organization.html | 1 + .../partials/schemas/schema_Person.html | 5 ++-- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 themes/nluug/layouts/partials/schemas/schema_BreadcrumbList.html diff --git a/config/_default/params.toml b/config/_default/params.toml index 407407b..28d60ee 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -3,6 +3,14 @@ # Voor Schema.org organization_name = "NLUUG" +organization_sameas = [ + "https://nluug.social/@nluug", + "https://twitter.com/nluug", + "https://www.wikidata.org/wiki/Q2137723", +] + +### Algemeen + description = "NLUUG website met de doelstellingen, laatste nieuws en evenementen van onze vereniging." # Fallback-auteur voor posts die geen echte auteur hebben author = "NLUUG" @@ -34,4 +42,6 @@ mastodon_instance = "https://nluug.social/" mastodon_handle = "nluug" twitter_handle = "nluug" + + # EOF diff --git a/themes/nluug/layouts/partials/schemas/include-relevant-schemas.html b/themes/nluug/layouts/partials/schemas/include-relevant-schemas.html index a4b9196..feb8847 100644 --- a/themes/nluug/layouts/partials/schemas/include-relevant-schemas.html +++ b/themes/nluug/layouts/partials/schemas/include-relevant-schemas.html @@ -5,6 +5,8 @@ {{- else if .IsPage -}} + {{ partial "schemas/schema_BreadcrumbList.html" . }} + {{ if in .Params.content_types "person" }} {{ partial "schemas/schema_Person.html" . }} {{ end }} diff --git a/themes/nluug/layouts/partials/schemas/schema_BreadcrumbList.html b/themes/nluug/layouts/partials/schemas/schema_BreadcrumbList.html new file mode 100644 index 0000000..65ff1b8 --- /dev/null +++ b/themes/nluug/layouts/partials/schemas/schema_BreadcrumbList.html @@ -0,0 +1,24 @@ +{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} +{{ $.Scratch.Delete "path" }} +{{ $.Scratch.Add "path" .Site.BaseURL }} +{{ $count := len (split $url "/") }} + diff --git a/themes/nluug/layouts/partials/schemas/schema_Organization.html b/themes/nluug/layouts/partials/schemas/schema_Organization.html index 17c0105..a6fe9d8 100644 --- a/themes/nluug/layouts/partials/schemas/schema_Organization.html +++ b/themes/nluug/layouts/partials/schemas/schema_Organization.html @@ -21,6 +21,7 @@ "postalCode": "{{ .postalcode | default .Site.Params.textNoValue }}" }, {{- end -}} + "sameAs": {{ .Site.Params.organization_sameas }}, "telephone":"{{ .Site.Params.phone }}" } diff --git a/themes/nluug/layouts/partials/schemas/schema_Person.html b/themes/nluug/layouts/partials/schemas/schema_Person.html index 576d5df..6d8238c 100644 --- a/themes/nluug/layouts/partials/schemas/schema_Person.html +++ b/themes/nluug/layouts/partials/schemas/schema_Person.html @@ -12,6 +12,7 @@ { "@type": "Organization", "name": "{{ $.Site.Params.organization_name | default .Site.Params.textEmptyValue }}" + "sameAs": {{ .Site.Params.organization_sameas }}, } ], {{ if $author.gender }}"gender": "{{ $author.gender }}",{{ end }} @@ -22,9 +23,7 @@ "worksFor": [ { "@type": "Organization", - "name": "{{ .Site.Params.name | default .Site.Params.textEmptyValue }}", - "sameAs": [ {{ partial "schemas/schema_Social.html" .Site.Params }} - ] + "name": "{{ .Site.Params.name | default .Site.Params.textEmptyValue }}" } ], {{ end }}