lib/sitemap.xml in jekyll-sitemap-0.12.0 vs lib/sitemap.xml in jekyll-sitemap-0.13.0
- old
+ new
@@ -1,41 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
+{% if page.xsl %}
+ <?xml-stylesheet type="text/xsl" href="{{ "/sitemap.xsl" | absolute_url }}"?>
+{% endif %}
<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">
- {% for post in site.posts %}{% unless post.sitemap == false %}
- <url>
- <loc>{{ post.url | absolute_url }}</loc>
- <lastmod>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</lastmod>
- </url>
- {% endunless %}{% endfor %}
- {% for page in site.html_pages %}{% unless page.sitemap == false %}
- <url>
- <loc>{{ page.url | replace:'/index.html','/' | absolute_url }}</loc>
- {% if page.last_modified_at %}
- <lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
- {% endif %}
- </url>
- {% endunless %}{% endfor %}
- {% for collection in site.collections %}{% unless collection.last.output == false or collection.output == false or collection.label == 'posts' %}
- {% for doc in collection.last.docs %}{% unless doc.sitemap == false %}
- <url>
- <loc>{{ doc.url | replace:'/index.html','/' | absolute_url }}</loc>
- {% if doc.last_modified_at %}
- <lastmod>{{ doc.last_modified_at | date_to_xmlschema }}</lastmod>
- {% endif %}
- </url>
- {% endunless %}{% endfor %}
- {% for doc in collection.docs %}{% unless doc.sitemap == false %}
+ {% 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 }}</loc>
+ {% if doc.last_modified_at or doc.date %}
+ <lastmod>{{ doc.last_modified_at | default: doc.date | date_to_xmlschema }}</lastmod>
+ {% endif %}
+ </url>
+ {% endfor %}
+ {% endfor %}
+
+ {% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' %}
+ {% for page in pages %}
<url>
- <loc>{{ doc.url | replace:'/index.html','/' | absolute_url }}</loc>
- {% if doc.last_modified_at %}
- <lastmod>{{ doc.last_modified_at | date_to_xmlschema }}</lastmod>
+ <loc>{{ page.url | replace:'/index.html','/' | absolute_url }}</loc>
+ {% if page.last_modified_at %}
+ <lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
{% endif %}
</url>
- {% endunless %}{% endfor %}
- {% endunless %}{% endfor %}
+ {% endfor %}
+
{% for file in page.static_files %}
- <url>
- <loc>{{ file.path | absolute_url }}</loc>
- <lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
- </url>
+ <url>
+ <loc>{{ file.path | absolute_url }}</loc>
+ <lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
+ </url>
{% endfor %}
</urlset>