Skip to content

Instantly share code, notes, and snippets.

@matijs
Created July 11, 2014 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matijs/13c2c1f8856fd3d4906e to your computer and use it in GitHub Desktop.
Save matijs/13c2c1f8856fd3d4906e to your computer and use it in GitHub Desktop.
Jekyll sitemap
---
layout: none
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}{% unless post.unpublished == false %}<url>
<loc>{{ site.url }}{{ post.url }}</loc>
<lastmod>{% if post.sitemap.lastmod %}{{ post.sitemap.lastmod | date: "%Y-%m-%d" }}{% else %}{{ post.date | date_to_xmlschema }}{% endif %}</lastmod>{% if post.sitemap.changefreq %}
<changefreq>{{ post.sitemap.changefreq }}</changefreq>{% endif %}{% if post.sitemap.priority %}
<priority>{{ post.sitemap.priority }}</priority>{% endif %}
</url>{% endunless %}{% endfor %}
{% for page in site.pages %}{% if page.sitemap != null %}<url>
<loc>{{ site.url }}{{ page.url | replace: 'index.html', '' }}</loc>{% if page.sitemap.changefreq %}
<changefreq>{{ page.sitemap.changefreq }}</changefreq>{% endif %}{% if page.sitemap.priority %}
<priority>{{ page.sitemap.priority }}</priority>{% endif %}
</url>{% endif %}{% endfor %}
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment