forked from earthlab/earthlab.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap.xml
51 lines (40 loc) · 1.6 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
---
layout:
---
<?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">
{% comment %}
*
* This page tries to recreate a better site map with
* 1. A date modified taken from the modified yaml element
* 2. Posts sorted by date modified < need to check with kendra about what sort is ideal? >
* 3. ignores page with sitemap: false
* 4. ignores other html pages like leaflet pages
* 5. i've read the the order of things in this page doesn't matter - currently
* the tutorial pages only have a date yaml element whereas the other pages have modified
* this makes it difficult to sort by date as there isn't one unique field.
*
*
{% endcomment %}
{% assign sorted_posts = site.posts | sort: 'date' %}
{% for post in site.posts %}
{% if post.sitemap == false %}
{% else %}
<url>
<loc>{{ site.url }}{{ post.url }}</loc>
<lastmod>{% if post.modified %}{{ post.modified | date_to_xmlschema }} {% else %} {{ post.date | date_to_xmlschema }} {% endif %}</lastmod>
</url>
{% endif %}
{% endfor %}
{% for page in site.pages %}
{% if page.sitemap == false %}
{% elsif page.url contains '.' %}
{% elsif page.url contains "/assets/" %}
{% else %}
<url>
<loc>{{ site.url }}{{ page.url }}</loc>
{% if page.date %}<lastmod>{% if page.modified %}{{ page.modified | date_to_xmlschema }} {% elsif page.date %} {{ page.date | date_to_xmlschema }} {% endif %}</lastmod>{% endif %}
</url>
{% endif %}
{% endfor %}
</urlset>