-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsitemap.xml
More file actions
41 lines (40 loc) · 1.98 KB
/
Copy pathsitemap.xml
File metadata and controls
41 lines (40 loc) · 1.98 KB
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
---
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<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:image="http://www.google.com/schemas/sitemap-image/1.1">
{% assign latest_post = site.posts | first %}
{% assign collections = site.collections | where_exp:'collection','collection.output != false' | sort: 'label' %}
{% for collection in collections %}
{% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' | sort: 'url' %}
{% for doc in docs %}
<url>
<loc>{{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
{% if doc.last_modified_at or doc.date %}
<lastmod>{{ doc.last_modified_at | default: doc.date | date_to_xmlschema }}</lastmod>
{% endif %}
{% if doc.image %}
<image:image>
<image:loc>{{ doc.image | prepend: site.baseurl | prepend: site.url }}</image:loc>
</image:image>
{% endif %}
</url>
{% endfor %}
{% endfor %}
{% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' | sort: 'url' %}
{% for page in pages %}
{% if page.name == "index.html" and page.dir != "/" and page.dir contains "/page" %}
{% else %}
<url>
<loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
{% if page.last_modified_at %}
<lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
{% elsif page.url == "/" or page.url == "/category" or page.url == "/timeline" %}
{% if latest_post.last_modified_at or latest_post.date %}
<lastmod>{{ latest_post.last_modified_at | default: latest_post.date | date_to_xmlschema }}</lastmod>
{% endif %}
{% endif %}
</url>
{% endif %}
{% endfor %}
</urlset>