|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +{% if page.xsl %} |
| 3 | + <?xml-stylesheet type="text/xsl" href="{{ "/sitemap.xsl" | absolute_url }}"?> |
| 4 | +{% endif %} |
| 5 | +<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> |
| 6 | + {% assign collections = site.collections | where_exp:'collection','collection.output != false' %} |
| 7 | + {% for collection in collections %} |
| 8 | + {%- assign locale = page.locale | default: site.locale | default: "en" %} |
| 9 | + {% assign docs = collection.docs | where: "locale", locale | where_exp:'doc','doc.sitemap != false' %} |
| 10 | + {% for doc in docs %} |
| 11 | + <url> |
| 12 | + <loc>{{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc> |
| 13 | + {% if doc.last_modified_at or doc.date %} |
| 14 | + <lastmod>{{ doc.last_modified_at | default: doc.date | date_to_xmlschema }}</lastmod> |
| 15 | + {% endif %} |
| 16 | + {% if doc.default.translations %} |
| 17 | + {% for item in doc.default.translations %} |
| 18 | + <xhtml:link rel="alternate" hreflang="{{ item[0] }}" href="{{ item[1].url | absolute_url }}"/> |
| 19 | + {% endfor %} |
| 20 | + {% endif %} |
| 21 | + {% if doc.default.fallbacks %} |
| 22 | + {% for item in doc.default.fallbacks %} |
| 23 | + <xhtml:link rel="alternate" hreflang="{{ item[0] }}" href="{{ item[1].url | absolute_url }}"/> |
| 24 | + {% endfor %} |
| 25 | + {% endif %} |
| 26 | + </url> |
| 27 | + {% endfor %} |
| 28 | + {% endfor %} |
| 29 | + |
| 30 | + {% assign pages = site.html_pages | where: "locale", locale | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %} |
| 31 | + {% for page in pages %} |
| 32 | + <url> |
| 33 | + <loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc> |
| 34 | + {% if page.last_modified_at or page.date %} |
| 35 | + <lastmod>{{ page.last_modified_at | default: page.date | date_to_xmlschema }}</lastmod> |
| 36 | + {% endif %} |
| 37 | + {% if page.default.translations %} |
| 38 | + {% for item in page.default.translations %} |
| 39 | + <xhtml:link rel="alternate" hreflang="{{ item[0] }}" href="{{ item[1].url | absolute_url }}"/> |
| 40 | + {% endfor %} |
| 41 | + {% endif %} |
| 42 | + {% if page.default.fallbacks %} |
| 43 | + {% for item in page.default.fallbacks %} |
| 44 | + <xhtml:link rel="alternate" hreflang="{{ item[0] }}" href="{{ item[1].url | absolute_url }}"/> |
| 45 | + {% endfor %} |
| 46 | + {% endif %} |
| 47 | + </url> |
| 48 | + {% endfor %} |
| 49 | + |
| 50 | + {% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %} |
| 51 | + {% for file in static_files %} |
| 52 | + <url> |
| 53 | + <loc>{{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }}</loc> |
| 54 | + <lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod> |
| 55 | + </url> |
| 56 | + {% endfor %} |
| 57 | +</urlset> |
0 commit comments