Debian Codegraph @

mkdocs_static_i18n/custom_i18n_sitemap/sitemap.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
3
4 {%- for locale, i18n_files in i18n_alternates.items() %}
5
6 {%- for file in i18n_files %}
7 {%- if file.page.is_link %}
8 {%- continue %}
9 {%- endif %}
10
11 {%- if not file.page %}
12 {%- continue %}
13 {%- endif %}
14
15 {%- if file.page.canonical_url %}
16 {%- set page_href = file.page.canonical_url | e %}
17 {%- elif file.page.abs_url %}
18 {%- set page_href = file.page.abs_url | e %}
19 {%- else %}
20 {%- set page_href = config.site_url ~ file.url %}
21 {%- endif %}
22
23 {#-
24 Warning! Don't align the XML tags based on the Jinja2 statements.
25 It will cause whitespace misalignment in the output.
26 #}
27 <url>
28 <loc>{{ page_href }}</loc>
29 {%- if file.page.update_date %}
30 <lastmod>{{ file.page.update_date }}</lastmod>
31 {%- endif %}
32 <changefreq>daily</changefreq>
33 {%- for i18n_locale, i18n_file in file.alternates.items() %}
34
35 {%- if i18n_file.page.canonical_url %}
36 {%- set i18n_href = i18n_file.page.canonical_url | e %}
37 {%- elif i18n_file.page.abs_url %}
38 {%- set i18n_href = i18n_file.page.abs_url | e %}
39 {%- else %}
40 {%- if i18n_file.url == "./" %}
41 {%- set i18n_href = config.site_url %}
42 {%- else %}
43 {%- set i18n_href = config.site_url ~ i18n_file.url %}
44 {%- endif %}
45 {%- endif %}
46 <xhtml:link rel="alternate" hreflang="{{ i18n_locale }}" href="{{ i18n_href }}"/>
47 {%- endfor %}
48 </url>
49 {%- endfor %}
50 {%- endfor %}
51 </urlset>