summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-08-27 17:25:46 -0500
committerDan McGee <dan@archlinux.org>2010-08-27 17:25:46 -0500
commite595665abd8700afc6474f08bef95eea3c986260 (patch)
treee6eb9034c0d844a723cf48c4593f7029fa22ba00
parentd21de73592062bce687e78e2dc4d0f415f42b3cf (diff)
Add a package groups sitemap
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitemaps.py19
-rw-r--r--urls.py9
2 files changed, 22 insertions, 6 deletions
diff --git a/sitemaps.py b/sitemaps.py
index 25b48c68..584e3b3b 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -1,8 +1,9 @@
from django.contrib.sitemaps import Sitemap
from main.models import Package, News
+from packages.views import get_group_information
class PackagesSitemap(Sitemap):
- changefreq = "monthly"
+ changefreq = "weekly"
priority = "0.5"
def items(self):
@@ -14,6 +15,7 @@ class PackagesSitemap(Sitemap):
class PackageFilesSitemap(PackagesSitemap):
+ changefreq = "monthly"
priority = "0.3"
def location(self, obj):
@@ -23,6 +25,20 @@ class PackageFilesSitemap(PackagesSitemap):
return obj.files_last_update
+class PackageGroupsSitemap(Sitemap):
+ changefreq = "weekly"
+ priority = "0.4"
+
+ def items(self):
+ return get_group_information()
+
+ def lastmod(self, obj):
+ return obj['last_update']
+
+ def location(self, obj):
+ return '/groups/%s/%s/' % (obj['arch'], obj['name'])
+
+
class NewsSitemap(Sitemap):
changefreq = "never"
priority = "0.7"
@@ -34,4 +50,3 @@ class NewsSitemap(Sitemap):
return obj.postdate
# vim: set ts=4 sw=4 et:
-
diff --git a/urls.py b/urls.py
index 7d7e363c..0030343c 100644
--- a/urls.py
+++ b/urls.py
@@ -8,12 +8,13 @@ from django.contrib.auth.decorators import permission_required
from main.models import Todolist
from feeds import PackageFeed, NewsFeed
-from sitemaps import NewsSitemap, PackagesSitemap, PackageFilesSitemap
+import sitemaps
sitemaps = {
- 'news': NewsSitemap,
- 'packages': PackagesSitemap,
- 'package-files': PackageFilesSitemap,
+ 'news': sitemaps.NewsSitemap,
+ 'packages': sitemaps.PackagesSitemap,
+ 'package-files': sitemaps.PackageFilesSitemap,
+ 'package-groups': sitemaps.PackageGroupsSitemap,
}
admin.autodiscover()