diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-15 23:55:03 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-15 23:55:03 +0200 |
commit | cda9c5bb34b450b391500636c8d3f5ff4bfe51ab (patch) | |
tree | 0084c793312e2c58077bfc38555342bdb42ac04c | |
parent | b0bad20756549df5edf726771c8e6869caba6244 (diff) | |
download | archweb-cda9c5bb34b450b391500636c8d3f5ff4bfe51ab.tar.gz archweb-cda9c5bb34b450b391500636c8d3f5ff4bfe51ab.tar.xz |
Add a base pages sitemap
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | packages/urls.py | 4 | ||||
-rw-r--r-- | sitemaps.py | 34 | ||||
-rw-r--r-- | urls.py | 1 |
3 files changed, 36 insertions, 3 deletions
diff --git a/packages/urls.py b/packages/urls.py index 3c2c87b..d408e6c 100644 --- a/packages/urls.py +++ b/packages/urls.py @@ -19,10 +19,10 @@ urlpatterns = patterns('packages.views', 'signoff_package'), (r'^update/$', 'update'), - (r'^$', 'search'), + (r'^$', 'search', {}, 'packages-search'), (r'^(?P<page>\d+)/$', 'search'), - (r'^differences/$', 'arch_differences'), + (r'^differences/$', 'arch_differences', {}, 'packages-differences'), (r'^stale_relations/$', 'stale_relations'), (r'^stale_relations/update/$','stale_relations_update'), diff --git a/sitemaps.py b/sitemaps.py index 37387f1..8ac5bc4 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: @@ -10,6 +10,7 @@ from feeds import PackageFeed, NewsFeed import sitemaps sitemaps = { + 'base': sitemaps.BaseSitemap, 'news': sitemaps.NewsSitemap, 'packages': sitemaps.PackagesSitemap, 'package-files': sitemaps.PackageFilesSitemap, |