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">
[ [
{ {
@ -13,61 +15,43 @@
}, },
"primaryImageOfPage": "{{ .Site.Params.imageurl | absURL | default .Site.Params.textEmptyValue }}" "primaryImageOfPage": "{{ .Site.Params.imageurl | absURL | default .Site.Params.textEmptyValue }}"
}, },
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "WebSite", "@type": "WebSite",
"@id": "{{ .Site.BaseURL }}", "@id": "{{ .Site.BaseURL }}",
"additionalType": ["CreativeWork", "Person"], "additionalType": ["CreativeWork", "Person"],
"url": "{{ .Site.BaseURL }}", "url": "{{ .Site.BaseURL }}",
"name": "{{ .Site.Title | default .Site.Params.textNoTitle }}", "name": "{{ .Site.Title | default .Site.Params.textNoTitle }}",
"alternateName": "{{ .Site.Title | default .Site.Params.textNoTitle }}", "alternateName": "{{ .Site.Title | default .Site.Params.textNoTitle }}",
"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": {
"@type": "Organization", "@type": "Organization",
"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": { "potentialAction": {
"@context": "https://schema.org", "@type": "SearchAction",
"@type": "localBusiness", "target": {
"name": "{{ .Site.Title }}", "@type": "EntryPoint",
"image":"{{ $location.thumbnail | absURL }}", "urlTemplate": "{{ absURL "/zoeken/" }}?q={search_term_string}"
"priceRange":"{{ .Site.Params.pricerange }}", },
"telephone":"{{ .Site.Params.phone }}", "query-input": "required name=search_term_string"
"address": { },
"@type": "PostalAddress", "keywords":[
"streetAddress": "{{ $location.address.street }}", {{ range $i, $e := .Site.Params.keywords }}{{ if $i }}, {{ end }}"{{ $e }}"{{ end }}
"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": {
"@type": "SearchAction",
"target": "{{ .Site.BaseURL }}?search={search_term}",
"query-input": "required name=search_term"
},
"keywords":[
{{ range $i, $e := .Site.Params.keywords }}{{ if $i }}, {{ end }}"{{ $e }}"{{ end }}
],
"hasPart": [ "hasPart": [
{ {
"@context": "http://schema.org/", "@context": "http://schema.org/",
@ -103,16 +87,16 @@
{{ range $i, $e := .Site.Menus.main }}{{ if $i }}, {{ end }}"{{ $e.URL | absURL }}"{{ end }} {{ range $i, $e := .Site.Menus.main }}{{ if $i }}, {{ end }}"{{ $e.URL | absURL }}"{{ end }}
] ]
}, },
{ {
"@context": "http://schema.org/", "@context": "http://schema.org/",
"@type": "WPFooter", "@type": "WPFooter",
"cssSelector": ".footer", "cssSelector": ".footer",
"@id": "#footer", "@id": "#footer",
"copyrightHolder":"{{ .Site.Title }}", "copyrightHolder":"{{ .Site.Title }}",
"publisher": "{{ .Site.Title }}", "publisher": "{{ .Site.Title }}",
"copyrightYear":"{{ now.Format "2006"}}" "copyrightYear":"{{ now.Format "2006"}}"
} }
] ]
} }
] ]
</script> </script>