summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-11-08 15:52:18 -0600
committerDan McGee <dan@archlinux.org>2014-11-08 15:54:56 -0600
commita3015ba8429a09878ed6c35d7c7c76a882de7dcf (patch)
treed843983822650f7734f799b9b0c9a2d50ebb6ea3
parent1a35cbe842212d674d83196ecfa70569ffe2e2da (diff)
Override default sitemap.xml template
The Django one uses the spaceless tag, which isn't all that useful when we are gzipping the response anyway. Remove it to make generation a tad faster. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--templates/sitemaps/sitemap.xml9
-rw-r--r--urls.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/templates/sitemaps/sitemap.xml b/templates/sitemaps/sitemap.xml
new file mode 100644
index 00000000..50a95237
--- /dev/null
+++ b/templates/sitemaps/sitemap.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+{% for url in urlset %}<url>
+<loc>{{ url.location }}</loc>
+{% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod>{% endif %}
+{% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %}
+{% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %}
+</url>{% endfor %}
+</urlset>
diff --git a/urls.py b/urls.py
index 518e88e7..2d174012 100644
--- a/urls.py
+++ b/urls.py
@@ -81,7 +81,7 @@ urlpatterns += patterns('',
{'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
(r'^sitemap-(?P<section>.+)\.xml$',
cache_page(1831)(sitemap_views.sitemap),
- {'sitemaps': our_sitemaps}, 'sitemaps'),
+ {'sitemaps': our_sitemaps, 'template_name': 'sitemaps/sitemap.xml'}, 'sitemaps'),
)
# Authentication / Admin