Skip to content

Instantly share code, notes, and snippets.

@Silverneo
Created September 3, 2014 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silverneo/66009a43e9603e7f05e7 to your computer and use it in GitHub Desktop.
Save Silverneo/66009a43e9603e7f05e7 to your computer and use it in GitHub Desktop.
sitemap.xml template
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}
<url>
<loc>{{ site.production_url }}{{ post.url }}</loc>
{% if post.lastmod == null %}
<lastmod>{{ post.date | date_to_xmlschema }}</lastmod>
{% else %}
<lastmod>{{ post.lastmod | date_to_xmlschema }}</lastmod>
{% endif %}
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
{% endfor %}
{% for page in site.pages %}
{% if page.sitemap != null and page.sitemap != empty %}
<url>
<loc>{{ site.production_url }}{{ page.url }}</loc>
<lastmod>{{ page.sitemap.lastmod | date_to_xmlschema }}</lastmod>
<changefreq>{{ page.sitemap.changefreq }}</changefreq>
<priority>{{ page.sitemap.priority }}</priority>
</url>
{% endif %}
{% endfor %}
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment