Skip to content

Instantly share code, notes, and snippets.

@agragregra
Created October 12, 2016 21:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save agragregra/a4c4c1f1d069b0dfb3983070a3473a40 to your computer and use it in GitHub Desktop.
Save agragregra/a4c4c1f1d069b0dfb3983070a3473a40 to your computer and use it in GitHub Desktop.
Jekyll Sitemap Without Plugins
---
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}{% unless post.published == false %}<url>
<loc>{{ site.url }}{{ post.url }}</loc>
{% if post.date %}<lastmod>{{ post.date | date_to_xmlschema }}</lastmod>{% endif %}
</url>{% endunless %}
{% endfor %}
{% for page in site.pages %}<url>
<loc>{{ site.url }}{{ page.url | remove: "index.html" }}</loc>
{% if page.date %}<lastmod>{{ page.date | date_to_xmlschema }}</lastmod>{% else %}<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>{% endif %}
</url>
{% endfor %}
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment