Skip to content

Instantly share code, notes, and snippets.

@DarrylDias
Created September 20, 2014 12:09
Show Gist options
  • Save DarrylDias/cc8f0f8441102fdf0cbd to your computer and use it in GitHub Desktop.
Save DarrylDias/cc8f0f8441102fdf0cbd to your computer and use it in GitHub Desktop.
Sitemap written in Liquid for Jekyll. http://darryldias.me/blog/sitemap-for-jekyll
---
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{% for post in site.posts %}
<url>
<loc>{{ site.url }}{{ post.url | remove: 'index.html' }}</loc>
{% if page.date %}
<lastmod>{{ page.date | date: "%Y-%m-%d" }}</lastmod>
{% else %}
<lastmod>{{ site.time | date: "%Y-%m-%d" }}</lastmod>
{% endif %}
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
{% endfor %}
{% for page in site.pages %}
{% if page.layout != nil %}
{% if page.layout != 'redirect' %}
<url>
<loc>{{ site.url }}{{ page.url | remove: 'index.html' }}</loc>
{% if page.date %}
<lastmod>{{ page.date | date: "%Y-%m-%d" }}</lastmod>
{% else %}
<lastmod>{{ site.time | date: "%Y-%m-%d" }}</lastmod>
{% endif %}
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
{% endif %}
{% endif %}
{% endfor %}
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment