-
Notifications
You must be signed in to change notification settings - Fork 177
/
sitemaps.xml
129 lines (110 loc) · 3.81 KB
/
sitemaps.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
layout:
permalink: /sitemaps.xml
sitemap:
exclude: true
---
<?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">
{{- "
<!-- Posts -->" -}}
{%- assign posts = site.posts | sort: "url" -%}
{%- for post in posts -%}
{{- "
<url>" -}}
{{- "
<loc>" -}}{{- site.url -}}{{- post.url -}}{{- "</loc>" -}}
{{- "
<lastmod>" -}}
{%- if post.last_modified_at -%}
{{- post.last_modified_at | date_to_xmlschema -}}
{%- elsif post.date -%}
{{- post.date | date_to_xmlschema -}}
{%- else -%}
{{- site.time | date_to_xmlschema -}}
{%- endif -%}
{{- "</lastmod>" -}}
{{- "
<changefreq>" -}}
{%- if post.sitemap.changefreq -%}
{{- post.sitemap.changefreq -}}
{%- else -%}
{{- "weekly" -}}
{%- endif -%}
{{- "</changefreq>" -}}
{{- "
<priority>" -}}
{%- if post.sitemap.priority -%}
<priority>{{- post.sitemap.priority -}}</priority>
{%- else -%}
{{- "0.5" -}}
{%- endif -%}
{{- "</priority>" -}}
{%- if post.page_ref and post.lang -%}
{%- assign alternate_translations = site.posts | where: "page_ref", post.page_ref | sort: "lang" -%}
{%- for lang in site.supported_langs -%}
{%- assign alternate_translation = alternate_translations | where: "lang", lang | first -%}
{%- if alternate_translation -%}
{{- "
" -}}
<xhtml:link rel="alternate" hreflang="{{- alternate_translation.lang -}}" href="{{-site.url-}}{{- alternate_translation.url -}}"/>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{{- "
</url>" -}}
{%- endfor -%}
{{- "
<!-- Pages -->" -}}
{%- assign pages = site.pages | sort: "url" -%}
{%- for page in pages -%}
{%- capture is_asset -%}{%- include utils/data/string-starts-with string=page.url subString="/assets/" -%}{%- endcapture -%}
{%- capture is_feed -%}{%- include utils/data/string-starts-with string=page.url subString="/feed/" -%}{%- endcapture -%}
{%- unless page.sitemap.exclude or site.data.sitemap.excludes contains page.url or is_asset == "true" or is_feed == "true" -%}
{{- "
<url>" -}}
{{- "
<loc>" -}}{{- site.url -}}{{- page.url -}}{{- "</loc>" -}}
{{- "
<lastmod>" -}}
{%- if page.last_modified_at -%}
{{- page.last_modified_at | date_to_xmlschema -}}
{%- elsif page.date -%}
{{- page.date | date_to_xmlschema -}}
{%- else -%}
{{- site.time | date_to_xmlschema -}}
{%- endif -%}
{{- "</lastmod>" -}}
{{- "
<changefreq>" -}}
{%- if page.sitemap.changefreq -%}
{{- page.sitemap.changefreq -}}
{%- else -%}
{{- "weekly" -}}
{%- endif -%}
{{- "</changefreq>" -}}
{{- "
<priority>" -}}
{%- if page.sitemap.priority -%}
<priority>{{- page.sitemap.priority -}}</priority>
{%- else -%}
{{- "0.8" -}}
{%- endif -%}
{{- "</priority>" -}}
{%- if page.page_ref and page.lang -%}
{%- assign alternate_translations = site.pages | where: "page_ref", page.page_ref | sort: "lang" -%}
{%- for lang in site.supported_langs -%}
{%- assign alternate_translation = alternate_translations | where: "lang", lang | first -%}
{%- if alternate_translation -%}
{{- "
" -}}
<xhtml:link rel="alternate" hreflang="{{- alternate_translation.lang -}}" href="{{-site.url-}}{{- alternate_translation.url -}}"/>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{{- "
</url>" -}}
{%- endunless -%}
{%- endfor -%}
{{ "" }}
</urlset>