-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathsitemap.xml.twig
More file actions
38 lines (38 loc) · 2.02 KB
/
Copy pathsitemap.xml.twig
File metadata and controls
38 lines (38 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
{%- if site.page('xsl/sitemap') ~%}
<?xml-stylesheet type="text/xsl" href="{{ url('xsl/sitemap', {canonical: true}) }}" media="all"?>
{%- endif ~%}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
>
{%- for page in site.pages.showable|filter(p => p.canonical.url is not defined)|sort_by_date ~%}
<url>
<loc>{{ url(page, {canonical: true}) }}</loc>
<lastmod>{{ page.date|date('Y-m-d') }}</lastmod>
<changefreq>{{ page.sitemap.changefreq|default(config.pages.default.sitemap.changefreq) }}</changefreq>
<priority>{{ page.sitemap.priority|default(config.pages.default.sitemap.priority) }}</priority>
{#- translations ~#}
{%- if page.translations|default({})|length >= 1 and page.language is defined ~%}
{%- for alternate in page.translations ~%}
<xhtml:link rel="alternate" hreflang="{{ alternate.language }}" href="{{ url(alternate, {canonical: true}) }}"/>
{%- endfor ~%}
<xhtml:link rel="alternate" hreflang="{{ page.language }}" href="{{ url(page, {canonical: true}) }}"/>
{%- endif ~%}
{#- video ~#}
{%- if page.videos is defined and page.videos|length > 0 and page.image is defined ~%}
<video:video>
<video:title><![CDATA[{{ page.title }}]]></video:title>
<video:description><![CDATA[{{ page.description }}]]></video:description>
<video:thumbnail_loc>{{ url(asset(page.image) , {canonical: true}) }}</video:thumbnail_loc>
<video:content_loc>{{ url(asset(page.videos[0]), {canonical: true}) }}</video:content_loc>
{%- if 'embed' in page.output ~%}
<video:player_loc>{{ url(page, {canonical: true, format: 'embed'}) }}</video:player_loc>
{%- endif ~%}
<video:duration>{{ asset(page.videos[0]).video.duration|round }}</video:duration>
<video:publication_date>{{ page.date|date('c') }}</video:publication_date>
</video:video>
{%- endif ~%}
</url>
{%- endfor ~%}
</urlset>