Unverified Commit b6233ced authored by David Rosca's avatar David Rosca
Browse files

sitemap.xml: Try to fix build error due to nil lastmod date

parent e0cdbe01
......@@ -9,10 +9,12 @@ layout: null
{% for post in site.posts %}
<url>
<loc>{{site.url}}{{ site.baseurl }}{{ post.url }}</loc>
{% if post.lastmod == null %}
{% if post.sitemap.lastmod %}
<lastmod>{{ post.sitemap.lastmod | date: "%Y-%m-%d" }}</lastmod>
{% elsif post.date %}
<lastmod>{{ post.date | date_to_xmlschema }}</lastmod>
{% else %}
<lastmod>{{ post.lastmod | date_to_xmlschema }}</lastmod>
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
{% endif %}
<changefreq>weekly</changefreq>
<priority>1.0</priority>
......@@ -22,7 +24,13 @@ layout: null
{% if page.sitemap != null and page.sitemap != empty %}
<url>
<loc>{{ site.url }}{{ site.baseurl }}{{ page.url }}</loc>
<lastmod>{{ page.sitemap.lastmod | date_to_xmlschema }}</lastmod>
{% if page.sitemap.lastmod %}
<lastmod>{{ page.sitemap.lastmod | date: "%Y-%m-%d" }}</lastmod>
{% elsif page.date %}
<lastmod>{{ page.date | date_to_xmlschema }}</lastmod>
{% else %}
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
{% endif %}
<changefreq>{{ page.sitemap.changefreq }}</changefreq>
<priority>{{ page.sitemap.priority }}</priority>
</url>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment