mirror of
https://gitlab.com/veilid/veilid-dot-com.git
synced 2024-10-01 01:05:53 -04:00
100 lines
3.4 KiB
Twig
100 lines
3.4 KiB
Twig
|
{% if page.metatags.jsonld|default(site.metatags.jsonld|default(false)) %}
|
||
|
<script type="application/ld+json">{%- apply minify_js ~%}
|
||
|
[
|
||
|
{#- WebSite ~#}
|
||
|
{
|
||
|
"@context": "https://schema.org",
|
||
|
"@type": "WebSite",
|
||
|
"name": "{{ site.title }}",
|
||
|
"description": "{{ site.description }}",
|
||
|
"url": "{{ url('/', {canonical: true}) }}",
|
||
|
{%- if site.image is defined ~%}
|
||
|
"image": ["{{ url(site.image, {canonical: true}) }}"]
|
||
|
{%- endif ~%}
|
||
|
{%- if site.social is defined ~%},
|
||
|
"sameAs": [
|
||
|
{%- for social in site.social ~%}
|
||
|
{%- if social.url is defined ~%}
|
||
|
"{{ social.url }}"{% if not loop.last %},{% endif %}
|
||
|
{%- endif ~%}
|
||
|
{%- endfor ~%}
|
||
|
]
|
||
|
{%- endif ~%}
|
||
|
}
|
||
|
{#- SiteNavigationElement ~#}
|
||
|
{%- if site.menus.main is defined -%}
|
||
|
,{
|
||
|
"@context":"http://schema.org",
|
||
|
"@type":"ItemList",
|
||
|
"itemListElement":[
|
||
|
{%- for item in site.menus.main|filter(i => i.id != site.home)|sort_by_weight ~%}
|
||
|
{
|
||
|
"@type": "SiteNavigationElement",
|
||
|
"position": {{ loop.index }},
|
||
|
"name": "{{ site.pages[item.id].title|default(item.name) }}",
|
||
|
"description": "{{ site.pages[item.id].description|default('') }}",
|
||
|
"url":"{{ url(item.url, {canonical: true}) }}"
|
||
|
}{%- if not loop.last %},{% endif -%}
|
||
|
{%~ endfor ~%}
|
||
|
]
|
||
|
}
|
||
|
{%- endif ~%}
|
||
|
{#- BreadcrumbList ~#}
|
||
|
{%- if page.section -%}
|
||
|
,{
|
||
|
"@context": "https://schema.org",
|
||
|
"@type": "BreadcrumbList",
|
||
|
"itemListElement": [{
|
||
|
"@type": "ListItem",
|
||
|
"position": 1,
|
||
|
"name": "{{ page.section|capitalize }}",
|
||
|
"item": "{{ url(page.section, {canonical: true}) }}"
|
||
|
},{
|
||
|
"@type": "ListItem",
|
||
|
"position": 2,
|
||
|
"name": "{{ page.title|e }}",
|
||
|
"item": "{{ url(page, {canonical: true}) }}"
|
||
|
}]
|
||
|
}
|
||
|
{#- NewsArticle ~#}
|
||
|
{%- if page.section == site.metatags.articles|default('blog') -%}
|
||
|
,{
|
||
|
"@context": "https://schema.org",
|
||
|
"@type": "NewsArticle",
|
||
|
"mainEntityOfPage": {
|
||
|
"@type": "WebPage",
|
||
|
"@id": "{{ url(page, {canonical: true}) }}"
|
||
|
},
|
||
|
"headline": "{{ page.title|e }}",
|
||
|
{%- if page.image is defined ~%}
|
||
|
"image": [
|
||
|
"{{ url(page.image, {canonical: true}) }}"
|
||
|
],
|
||
|
{%- endif ~%}
|
||
|
"datePublished": "{{ page.date|date('Y-m-dTH:i:sP') }}",
|
||
|
"dateModified": "{{ page.date|date('Y-m-dTH:i:sP') }}",
|
||
|
{%- if author.name|default('') is not empty ~%}
|
||
|
"author": {
|
||
|
"@type": "Person",
|
||
|
"name": "{{ author.name }}"
|
||
|
{%- if author.url|default('') is not empty ~%},
|
||
|
"url": "{{ author.url }}"
|
||
|
{%- endif ~%}
|
||
|
},
|
||
|
{%- endif ~%}
|
||
|
"publisher": {
|
||
|
"@type": "Organization",
|
||
|
"name": "{{ site.title }}"
|
||
|
{%- if favicon_url is not empty ~%},
|
||
|
"logo": {
|
||
|
"@type": "ImageObject",
|
||
|
"url": "{{ favicon_url }}"
|
||
|
}
|
||
|
{%- endif ~%}
|
||
|
}
|
||
|
}
|
||
|
{%- endif ~%}
|
||
|
{%- endif ~%}
|
||
|
]
|
||
|
{% endapply %}</script>
|
||
|
{%- endif %}
|