-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsitemap.xml
59 lines (56 loc) · 3.12 KB
/
sitemap.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
---
---
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="{{ "/assets/sitemap.xsl" | absolute_url }}"?>
<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">
{% assign collections = site.collections | where_exp:'collection','collection.output != false' %}
{% for collection in collections %}
{% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %}
{% for doc in docs %}
<url>
<loc>{{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
{% if doc.last_modified_at or doc.date %}
<lastmod>{{ doc.last_modified_at | default: doc.date | date_to_xmlschema }}</lastmod>
{% else %}{% assign latest = site.categories[doc.name] | where_exp:'p','p.sitemap != false' | first %}
<lastmod>{{ latest.last_modified_at | default: latest.date | date_to_xmlschema }}</lastmod>
{% endif %}
</url>
{% endfor %}
{% endfor %}
{% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.layout != "error"' %}
{% for page in pages %}
<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 == '/index.html' or page.url == '/' %}{% assign this = site.github.public_repositories | where: 'name',site.github.repository_name | first %}
<changefreq>weekly</changefreq>
<priority>1.0</priority>
<lastmod>{{ this.updated_at | date_to_xmlschema }}</lastmod>
{% elsif page.url contains '/blog/' %}{% assign latest = site.posts | first %}
<changefreq>weekly</changefreq>
<priority>0.8</priority>
<lastmod>{{ latest.last_modified_at | default: latest.date | date_to_xmlschema }}</lastmod>
{% endif %}
</url>
{% endfor %}
{% assign gh_pages = site.github.public_repositories | where_exp:'r','r.has_pages == true' | where_exp:'r','r.fork == false' | where_exp:'r','r.private == false' %}
{% for gh_page in gh_pages %}{% unless gh_page.name == site.github.repository_name or gh_page.topics contains 'noindex' %}
{% if gh_page.homepage == nil or gh_page.homepage == '' or gh_page.homepage contains site.url %}
<url>
<loc>{{ gh_page.name | prepend: '/' | append: '/' | absolute_url | xml_escape }}</loc>
<priority>0.7</priority>
<lastmod>{{ gh_page.updated_at | date_to_xmlschema }}</lastmod>
</url>
{% endif %}
{% endunless %}{% endfor %}
{% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %}
{% for file in static_files %}
<url>
<loc>{{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
<lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
</url>
{% endfor %}
</urlset>