forked from Hester-Tso/jekyll-multiling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.xml
39 lines (39 loc) · 1.6 KB
/
sitemap.xml
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
39
---
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{% for collection in site.collections %}
{{ collection.label }}
{% if site.lang.size > 1 %}{% assign docs = site[collection.label] | where: 'lang', site.lang.first %}
{% else %}{% assign docs = site[collection.label] %}{% endif %}
{% for doc in docs %}
<url>
<loc>{{ site.url }}{{ site.baseurl }}{{ doc.url }}</loc>
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
{% if site.lang.size > 1 %}
{% for translation_lang in site.lang %}
<xhtml:link rel="alternate" hreflang="{{ translation_lang }}" href="{{ site.url }}{{ site.baseurl }}{% if forloop.first != true %}/{{ translation_lang }}{% endif %}{{ doc.url }}"/>
{% endfor %}
{% endif %}
</url>
{% endfor %}
{% endfor %}
{% if site.lang.size > 1 %}{% assign docs = site.pages | where: 'lang', site.lang.first %}
{% else %}{% assign docs = site.pages %}{% endif %}
{% for doc in docs %}
<url>
<loc>{{ site.url }}{{ site.baseurl }}{{ doc.url }}</loc>
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.3</priority>
{% if site.lang.size > 1 %}
{% for translation_lang in site.lang %}
<xhtml:link rel="alternate" hreflang="{{ translation_lang }}" href="{{ site.url }}{{ site.baseurl }}{% if forloop.first != true %}/{{ translation_lang }}{% endif %}{{ doc.url }}"/>
{% endfor %}
{% endif %}
</url>
{% endfor %}
</urlset>