Schema structured data: toevoegen BreadcrumbList en aanvullen Organization

This commit is contained in:
Michael Boelen 2023-06-15 11:53:46 +02:00
parent 0ed802a015
commit d5d805730a
5 changed files with 39 additions and 3 deletions

View file

@ -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

View file

@ -5,6 +5,8 @@
{{- else if .IsPage -}}
{{ partial "schemas/schema_BreadcrumbList.html" . }}
{{ if in .Params.content_types "person" }}
{{ partial "schemas/schema_Person.html" . }}
{{ end }}

View file

@ -0,0 +1,24 @@
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $.Scratch.Delete "path" }}
{{ $.Scratch.Add "path" .Site.BaseURL }}
{{ $count := len (split $url "/") }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"item": "{{ .Site.BaseURL }}",
"name": "{{ .Site.Params.organization_name }}"
},{{ range $index, $element := split $url "/" }}{{ $.Scratch.Add "path" $element | safeJS }}{{ if $element }}
{
"@type": "ListItem",
"position": {{ add $index 2 }},
"item": "{{ $.Scratch.Get "path" }}",
"name": "{{ humanize . }}"
}{{ if not (eq $index (sub $count 2)) }}, {{ end }}{{ $.Scratch.Add "path" "/" | safeJS }}{{ end }}{{ end }}
]
}
</script>

View file

@ -21,6 +21,7 @@
"postalCode": "{{ .postalcode | default .Site.Params.textNoValue }}"
},
{{- end -}}
"sameAs": {{ .Site.Params.organization_sameas }},
"telephone":"{{ .Site.Params.phone }}"
}
</script>

View file

@ -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 }}