<?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 | uriencode }}</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.archive_dir + '/' | uriencode }}</loc>
      <lastmod>{{ sNow }}</lastmod>
      <changefreq>daily</changefreq>
      <priority>1.0</priority>
   </url>

  {# tag pages #}
  {% for tag in tags %}
    <url>
      <loc>{{ tag.permalink | uriencode }}</loc>
      <lastmod>{{ sNow }}</lastmod>
      <changefreq>daily</changefreq>
      <priority>0.6</priority>
    </url>
  {% endfor %}

  {# categories pages #}
  {% for cat in categories %}
    <url>
      <loc>{{ cat.permalink | uriencode }}</loc>
      <lastmod>{{ sNow }}</lastmod>
      <changefreq>daily</changefreq>
      <priority>0.6</priority>
    </url>
  {% endfor %}

</urlset>