diff options
author | 2018-07-10 14:53:59 +0100 | |
---|---|---|
committer | 2018-07-10 14:53:59 +0100 | |
commit | 28b72409b43cb401f5bef03747e888e1cf27262a (patch) | |
tree | 4fa4998816fe6ff4bf80db281dc12b3d68323490 /templates | |
parent | Merge branch 'fix-numbers-in-channel-names' into 'master' (diff) |
All domains: sitemap.xml and robots.txt
Diffstat (limited to 'templates')
-rw-r--r-- | templates/robots.txt | 14 | ||||
-rw-r--r-- | templates/sitemap.xml | 64 |
2 files changed, 78 insertions, 0 deletions
diff --git a/templates/robots.txt b/templates/robots.txt new file mode 100644 index 00000000..be2a512c --- /dev/null +++ b/templates/robots.txt @@ -0,0 +1,14 @@ +{# robots.txt is a little picky about whitespace and newlines - that's why the below looks kind of bad.#} +{% if rules is defined and rules %} +{% for user_agent, disallowed in rules %} +User-agent: {{ user_agent }} +{% for rule in rules %} +Disallow: {{ rule }} +{% endfor %} +{% endfor %} +{% else %} +User-agent: * +Disallow: +{% endif %} + +Sitemap: {{ sitemap_url }} diff --git a/templates/sitemap.xml b/templates/sitemap.xml new file mode 100644 index 00000000..3d63d3a9 --- /dev/null +++ b/templates/sitemap.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<urlset + xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" + xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" + xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" +> + +{% for url in urls %} + <url> + <loc>{{ url.url }}</loc> + + {% if url.images is defined %} + {% for image in url.images %} + <image:image> + <image:loc>{{ image.url }}</image:loc> + <image:caption>{{ image.caption }}</image:caption> + </image:image> + {% endfor %} + {% endif %} + + {% if url.videos is defined %} + {% for video in url.videos %} + <video:video> + <video:description>{{ video.description }}</video:description> + <video:title>{{ video.title }}</video:title> + + <video:content_loc>{{ video.url }}</video:content_loc> + <video:player_loc>{{ video.player_url }}</video:player_loc> + <video:thumbnail_loc>{{ video.thumbnail_url }}</video:thumbnail_loc> + </video:video> + {% endfor %} + {% endif %} + + {% if url.news_items is defined %} + {% for item in url.news_items %} + <news:news> + <news:publication> + <news:name>Python Discord: {{ item.section }}</news:name> + <news:language>en</news:language> + </news:publication> + + <news:genres>PressRelease, Blog</news:genres> + <news:publication_date>{{ item.date }}</news:publication_date> + <news:title>{{ item.title }}</news:title> + <news:keywords>{{ ", ".join(item.keywords) }}</news:keywords> + </news:news> + {% endfor %} + {% endif %} + + {% if url.last_modified is defined %} + <lastmod>{{ url.last_modified }}</lastmod> + {% endif %} + + {% if url.change_frequency is defined %} + <changefreq>{{ url.change_frequency }}</changefreq> + {% endif %} + + {% if url.priority is defined %} + <priority>{{ "{0:.1f}".format(url.priority) }}</priority> + {% endif %} + </url> +{% endfor %} +</urlset> |