7
0
Fork 0

Invullen van meer velden voor Schema.org

This commit is contained in:
Michael Boelen 2023-05-19 16:03:19 +02:00
parent 88c465f593
commit 49337eba68
2 changed files with 70 additions and 68 deletions

View file

@ -1,8 +1,26 @@
{{ $logoresource := resources.Get ($.Site.Params.logoNormal | replaceRE "^/" "") }}
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "https://schema.org/", "@context": "https://schema.org/",
"@type": "Organization", "@type": "NGO",
"url": "{{ .Site.BaseURL }}", "url": "{{ .Site.BaseURL }}",
"logo": "{{ .Site.Params.logoHiRes | absURL | default .Site.Params.textEmptyValue }}" "name": "{{ .Site.Title }}",
"logo": {
"@type": "ImageObject",
"url": "{{ $logoresource.Permalink | default .Site.Params.textNoValue }}",
"height": "{{ $logoresource.Height }}",
"width": {{ printf "%d" $logoresource.Width }}
},
{{- with .Site.Params.address -}}
"address": {
"@type": "PostalAddress",
"streetAddress": "{{ .street | default .Site.Params.textNoValue }}",
"addressLocality": "{{ .city | default .Site.Params.textNoValue }}",
"addressRegion": "{{ .region | default .Site.Params.textNoValue }}",
"addressCountry": "{{ .country | default .Site.Params.textNoValue }}",
"postalCode": "{{ .postalcode | default .Site.Params.textNoValue }}"
},
{{- end -}}
"telephone":"{{ .Site.Params.phone }}"
} }
</script> </script>

View file

@ -1,5 +1,7 @@
{{ $baseUrl := .Site.BaseURL }} {{ $baseUrl := .Site.BaseURL }}
{{ $location := index .Site.Data.location .Site.Params.primarylocation }} {{ $location := index .Site.Data.location .Site.Params.primarylocation }}
{{ $logoresource := resources.Get ($.Site.Params.logoNormal | replaceRE "^/" "") }}
<script type="application/ld+json"> <script type="application/ld+json">
[ [
{ {
@ -24,9 +26,9 @@
"headline": "{{ .Site.Params.description | default .Site.Params.textNoTitle }}", "headline": "{{ .Site.Params.description | default .Site.Params.textNoTitle }}",
"image": "{{ .Site.Params.imageurl | absURL | default .Site.Params.textNoTitle }}", "image": "{{ .Site.Params.imageurl | absURL | default .Site.Params.textNoTitle }}",
"inLanguage": "{{ .Site.LanguageCode }}", "inLanguage": "{{ .Site.LanguageCode }}",
"author": "{{ .Site.Params.author | default .Site.Params.textNoTitle }}", "author": "{{ .Site.Params.author | default .Site.Params.textNoValue }}",
"description": "{{ .Site.Params.description }}", "description": "{{ .Site.Params.description }}",
"disambiguatingDescription": "{{ .Site.Params.description | default .Site.Params.textNoTitle }}", "disambiguatingDescription": "{{ .Site.Params.description | default .Site.Params.textNoValue }}",
"isFamilyFriendly": "True", "isFamilyFriendly": "True",
"sourceOrganization": "{{ .Site.Title | default .Site.Params.textNoTitle }}", "sourceOrganization": "{{ .Site.Title | default .Site.Params.textNoTitle }}",
"publisher": { "publisher": {
@ -34,36 +36,18 @@
"name": "{{ .Site.Title | default .Site.Params.textNoTitle }}", "name": "{{ .Site.Title | default .Site.Params.textNoTitle }}",
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": "{{ .Site.Params.logourl | absURL | default .Site.Params.textNoTitle }}", "url": "{{ $logoresource.Permalink | default .Site.Params.textNoValue }}",
"height": 60, "height": "{{ printf "%d" $logoresource.Height }}",
"width": 107 "width": {{ printf "%d" $logoresource.Width }}
}
},
"mainEntity": {
"@context": "https://schema.org",
"@type": "localBusiness",
"name": "{{ .Site.Title }}",
"image":"{{ $location.thumbnail | absURL }}",
"priceRange":"{{ .Site.Params.pricerange }}",
"telephone":"{{ .Site.Params.phone }}",
"address": {
"@type": "PostalAddress",
"streetAddress": "{{ $location.address.street }}",
"addressLocality": "{{ $location.address.city }}",
"addressRegion": "{{ $location.address.region }}",
"addressCountry": "{{ $location.address.country }}",
"postalCode": "{{ $location.address.postalcode | default .Site.Params.textNoTitle }}"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.5",
"reviewCount": "50"
} }
}, },
"potentialAction": { "potentialAction": {
"@type": "SearchAction", "@type": "SearchAction",
"target": "{{ .Site.BaseURL }}?search={search_term}", "target": {
"query-input": "required name=search_term" "@type": "EntryPoint",
"urlTemplate": "{{ absURL "/zoeken/" }}?q={search_term_string}"
},
"query-input": "required name=search_term_string"
}, },
"keywords":[ "keywords":[
{{ range $i, $e := .Site.Params.keywords }}{{ if $i }}, {{ end }}"{{ $e }}"{{ end }} {{ range $i, $e := .Site.Params.keywords }}{{ if $i }}, {{ end }}"{{ $e }}"{{ end }}