mirror of
https://gitlab.com/veilid/veilid-dot-com.git
synced 2025-03-13 02:46:35 -04:00
137 lines
5.1 KiB
Twig
137 lines
5.1 KiB
Twig
{%- if page.metatags.jsonld|default(config.metatags.jsonld|default(false)) ~%}
|
|
<script type="application/ld+json">{%- apply minify_js ~%}
|
|
[
|
|
{#- WebSite ~#}
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "WebSite",
|
|
"name": "{{ site.title|e }}",
|
|
"description": "{{ site.description|e }}",
|
|
"url": "{{ url('/', {canonical: true}) }}"
|
|
{%- if site.image is defined ~%},
|
|
"image": ["{{ url(asset(site.image), {canonical: true}) }}"]
|
|
{%- endif ~%}
|
|
{%- if page.social|default(site.social|default) ~%},
|
|
"sameAs": [
|
|
{%- for social in page.social|default(site.social)|filter((v) => v['url'] is defined) ~%}
|
|
"{{ social.url }}"{% if not loop.last %},{% 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.page(item.id).title|default(item.name)|e }}",
|
|
"description": "{{ site.page(item.id).description|default|e }}",
|
|
"url": "{{ url(item.url, {canonical: true}) }}"
|
|
}{%- if not loop.last %},{% endif -%}
|
|
{%~ endfor ~%}
|
|
]
|
|
}
|
|
{%- endif -%}
|
|
{%- if page.section -%}
|
|
{#- BreadcrumbList -#}
|
|
,{
|
|
"@context": "https://schema.org",
|
|
"@type": "BreadcrumbList",
|
|
"itemListElement": [{
|
|
"@type": "ListItem",
|
|
"position": 1,
|
|
"name": "{{ site.page(page.section).title|default(page.section)|e }}",
|
|
"item": "{{ url(page.section, {canonical: true}) }}"
|
|
{%- if page.type != 'section' ~%}
|
|
},{
|
|
"@type": "ListItem",
|
|
"position": 2,
|
|
"name": "{{ title|default(page.title)|e }}",
|
|
"item": "{{ url(page, {canonical: true}) }}"
|
|
{%- endif ~%}
|
|
}]
|
|
}
|
|
{#- NewsArticle ~#}
|
|
{%- if page.section == config.metatags.articles|default('blog') and page.type != 'section' -%}
|
|
,{
|
|
"@context": "https://schema.org",
|
|
"@type": "NewsArticle",
|
|
"mainEntityOfPage": {
|
|
"@type": "WebPage",
|
|
"@id": "{{ url(page, {canonical: true}) }}"
|
|
},
|
|
"headline": "{{ title|default(page.title)|e }}",
|
|
{%- if image is defined ~%}
|
|
"image": [
|
|
"{{ url(image, {canonical: true}) }}"
|
|
],
|
|
{%- elseif 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|e }}"
|
|
{%- if author.url|default('') is not empty ~%},
|
|
"url": "{{ author.url }}"
|
|
{%- endif ~%}
|
|
{%- if author.image|default('') is not empty ~%},
|
|
"image": "{{ author.image }}"
|
|
{%- endif ~%}
|
|
{%- if author.title|default('') is not empty ~%},
|
|
"jobTitle": "{{ author.title }}"
|
|
{%- endif ~%}
|
|
{%- if author.email|default('') is not empty ~%},
|
|
"email": "{{ author.email }}"
|
|
{%- endif ~%}
|
|
{%- if author.telephone|default('') is not empty ~%},
|
|
"telephone": "{{ author.telephone }}"
|
|
{%- endif ~%}
|
|
},
|
|
{%- endif ~%}
|
|
"publisher": {
|
|
"@type": "Organization",
|
|
"name": "{{ site.title|e }}"
|
|
{%- if favicon_asset and not favicon_asset.missing ~%},
|
|
"logo": {
|
|
"@type": "ImageObject",
|
|
"url": "{{ url(favicon_asset, {canonical: true}) }}"
|
|
}
|
|
{%- endif ~%}
|
|
}
|
|
}
|
|
{%- endif ~%}
|
|
{%- endif ~%}
|
|
|
|
{#- VideoObject ~#}
|
|
{%- if opengraph.video is defined -%}
|
|
,{
|
|
"@context": "https://schema.org",
|
|
"@type": "VideoObject",
|
|
"name": "{{ title|default(page.title)|e }}",
|
|
{%- if page.description is defined ~%}
|
|
"description": "{{ page.description|e }}",
|
|
{%- endif ~%}
|
|
"thumbnailUrl": [
|
|
"{{ url(asset(page.poster), {canonical: true}) }}"
|
|
],
|
|
"uploadDate": "{{ page.date|date('Y-m-dTH:i:sP') }}",
|
|
{%- if page.duration is defined ~%}
|
|
"duration": "{{ page.duration|duration_to_iso8601 }}",
|
|
{%- endif ~%}
|
|
"contentUrl": "{{ url(opengraph.video, {canonical: true}) }}",
|
|
"embedUrl": "{{ url(page, {canonical: true, format: 'iframe'}) }}"
|
|
}
|
|
{%- endif ~%}
|
|
]
|
|
{% endapply %}</script>
|
|
{%- endif ~%} |