Skip to content

Instantly share code, notes, and snippets.

@justinhillsjohnson
Created February 28, 2015 00:33
Show Gist options
  • Save justinhillsjohnson/4c81e488db11b30dffa5 to your computer and use it in GitHub Desktop.
Save justinhillsjohnson/4c81e488db11b30dffa5 to your computer and use it in GitHub Desktop.
---
title: Sitemap
slug: sitemap
is_layout: false
listed: false
published: true
cache_strategy: none
response_type: text/xml
position: 3
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in site.pages %}
{% if page.published? and page.listed? %}
{% case page.slug %}
{% when 'index' %}
<url>
<loc>http://{{ host }}</loc>
<lastmod>{{ now | date: "%F" }}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
{% when 'resorts' %}
{% for resort in contents.resorts %}
<url>
<loc>http://{{ host }}/{{ contents.resorts.slug }}/{{ resort._permalink }}</loc>
<lastmod>{{ now | date: "%F" }}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
{% endfor %}
{% else %}
<url>
<loc>http://{{ host }}/{{ page.fullpath }}</loc>
<lastmod>{{ now | date: "%F" }}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
{% endcase %}
{% endif %}
{% endfor %}
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment