diff options
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: |