diff options
-rw-r--r-- | sitemaps.py | 19 | ||||
-rw-r--r-- | urls.py | 9 |
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: - @@ -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() |