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 40 41 42 43 44 45 46 47 48 49 50 51
|
---
layout: content
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{% for lang in site.languages %}
{% for node in site.pages %}
{% comment %}<!-- very lazy check to see if page is in the exclude list - this means excluded pages are not gonna be in the sitemap at all, write exceptions as necessary -->{% endcomment %}
{% unless site.exclude_from_localization contains node.path %}
{% comment %}<!-- assuming if there's not layout assigned, then not include the page in the sitemap, you may want to change this -->{% endcomment %}
{% if node.layout %}
<url>
<loc>{% if lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: lang | prepend: '/' | absolute_url }}{% endif %}</loc>
{% if node.last_modified_at and node.last_modified_at != node.date %}<lastmod>{{ node.last_modified_at | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% elsif node.date %}<lastmod>{{ node.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% endif %}
{% comment %}<!-- hreflang links for cross-language SEO -->{% endcomment %}
{% if node.permalink_lang %}
{% for alt_lang in site.languages %}
{% if node.permalink_lang[alt_lang] %}
<xhtml:link rel="alternate" hreflang="{{ alt_lang }}" href="{% if alt_lang == site.default_lang %}{{ node.permalink_lang[alt_lang] | absolute_url }}{% else %}{{ node.permalink_lang[alt_lang] | prepend: alt_lang | prepend: '/' | absolute_url }}{% endif %}"/>
{% endif %}
{% endfor %}
<xhtml:link rel="alternate" hreflang="x-default" href="{{ node.permalink_lang[site.default_lang] | absolute_url }}"/>
{% else %}
{% for alt_lang in site.languages %}
<xhtml:link rel="alternate" hreflang="{{ alt_lang }}" href="{% if alt_lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: alt_lang | prepend: '/' | absolute_url }}{% endif %}"/>
{% endfor %}
<xhtml:link rel="alternate" hreflang="x-default" href="{{ node.url | absolute_url }}"/>
{% endif %}
</url>
{% endif %}
{% endunless %}
{% endfor %}
{% comment %}<!-- This loops through all site collections including posts -->{% endcomment %}
{% for collection in site.collections %}
{% for node in site[collection.label] %}
<url>
<loc>{% if lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: lang | prepend: '/' | absolute_url }}{% endif %}</loc>
{% if node.last_modified_at and node.last_modified_at != node.date %}<lastmod>{{ node.last_modified_at | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% elsif node.date %}<lastmod>{{ node.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% endif %}
{% comment %}<!-- hreflang links for cross-language SEO -->{% endcomment %}
{% for alt_lang in site.languages %}
<xhtml:link rel="alternate" hreflang="{{ alt_lang }}" href="{% if alt_lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: alt_lang | prepend: '/' | absolute_url }}{% endif %}"/>
{% endfor %}
<xhtml:link rel="alternate" hreflang="x-default" href="{{ node.url | absolute_url }}"/>
</url>
{% endfor %}
{% endfor %}
{% endfor %}
</urlset>
|