<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  {% for post in posts %}
  <url>
    <loc>{{ post.permalink }}</loc>
    {% if post.lastUpdated() %}
    <lastmod>{{ post.lastUpdated() }}</lastmod>
    {% elif post.date %}
    <lastmod>{{ post.date }}</lastmod>
    {% endif %}
  </url>
  {% endfor %}

  {# home page #}
  <url>
      <loc>{{ config.url + config.root }}</loc>
      <lastmod>{{ sNow }}</lastmod>
   </url>

  {# archive page #}
  <url>
      <loc>{{ config.url + '/' + archive_dir + '/' }}</loc>
      <lastmod>{{ sNow }}</lastmod>
   </url>

  {# tag pages #}
  {% for tag in tags %}
    <url>
      <loc>{{ tag.permalink }}</loc>
      <lastmod>{{ sNow }}</lastmod>
    </url>
  {% endfor %}
</urlset>