diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-15 16:55:03 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-15 16:55:03 -0500 |
commit | cda9c5bb34b450b391500636c8d3f5ff4bfe51ab (patch) | |
tree | 0084c793312e2c58077bfc38555342bdb42ac04c /sitemaps.py | |
parent | b0bad20756549df5edf726771c8e6869caba6244 (diff) |
Add a base pages sitemap
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'sitemaps.py')
-rw-r--r-- | sitemaps.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/sitemaps.py b/sitemaps.py index 37387f15..8ac5bc4f 100644 --- a/sitemaps.py +++ b/sitemaps.py @@ -1,4 +1,6 @@ from django.contrib.sitemaps import Sitemap +from django.core.urlresolvers import reverse + from main.models import Package from news.models import News from packages.utils import get_group_info @@ -41,7 +43,7 @@ class PackageGroupsSitemap(Sitemap): class NewsSitemap(Sitemap): changefreq = "never" - priority = "0.7" + priority = "0.8" def items(self): return News.objects.all() @@ -49,4 +51,34 @@ class NewsSitemap(Sitemap): def lastmod(self, obj): return obj.last_modified + +class BaseSitemap(Sitemap): + base_viewnames = ( + ('index', 1.0, 'hourly'), + ('packages-search', 0.8, 'hourly'), + 'page-about', 'page-art', 'page-svn', 'page-devs', 'page-tus', + 'page-fellows', 'page-donate', 'page-download', 'news-list', + 'feeds-list', 'groups-list', 'mirror-list', 'mirror-status', + 'mirrorlist', 'packages-differences', 'releng-test-overview', + ) + + def items(self): + return self.base_viewnames + + def location(self, obj): + name = obj + if isinstance(obj, tuple): + name = obj[0] + return reverse(name) + + def priority(self, obj): + if isinstance(obj, tuple): + return obj[1] + return 0.7 + + def changefreq(self, obj): + if isinstance(obj, tuple): + return obj[2] + return 'monthly' + # vim: set ts=4 sw=4 et: |