diff options
-rw-r--r-- | robots.txt | 5 | ||||
-rw-r--r-- | sitemap.xml | 32 |
2 files changed, 37 insertions, 0 deletions
diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..e5123b2 --- /dev/null +++ b/robots.txt @@ -0,0 +1,5 @@ +--- +layout: content +--- +User-agent: * +Sitemap: {{ site.url }}/sitemap.xml diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..f9b79db --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,32 @@ +--- +layout: content +--- +<?xml version="1.0" encoding="UTF-8"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> +{% for lang in site.languages %} + + {% for node in site.pages %} + {% comment %}<!-- very lazy check to see if page is in the exclude list - this means excluded pages are not gonna be in the sitemap at all, write exceptions as necessary -->{% endcomment %} + {% unless site.exclude_from_localization contains node.path %} + {% comment %}<!-- assuming if there's not layout assigned, then not include the page in the sitemap, you may want to change this -->{% endcomment %} + {% if node.layout %} + <url> + <loc>{% if lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: lang | prepend: '/' | absolute_url }}{% endif %}</loc> + {% if node.last_modified_at and node.last_modified_at != node.date %}<lastmod>{{ node.last_modified_at | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% elsif node.date %}<lastmod>{{ node.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% endif %} + </url> + {% endif %} + {% endunless %} + {% endfor %} + + {% comment %}<!-- This loops through all site collections including posts -->{% endcomment %} + {% for collection in site.collections %} + {% for node in site[collection.label] %} + <url> + <loc>{% if lang == site.default_lang %}{{ node.url | absolute_url }}{% else %}{{ node.url | prepend: lang | prepend: '/' | absolute_url }}{% endif %}</loc> + {% if node.last_modified_at and node.last_modified_at != node.date %}<lastmod>{{ node.last_modified_at | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% elsif node.date %}<lastmod>{{ node.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>{% endif %} + </url> + {% endfor %} + {% endfor %} + +{% endfor %} +</urlset> |