summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-03-10 00:17:51 -0600
committerDan McGee <dan@archlinux.org>2010-03-10 00:17:51 -0600
commit5f9d98d40740d36ada63f7ff3627b18f91a0fc9c (patch)
tree50ac6c3136ba8034e9d7833be4b3aeb7f5ae3c34
parent9374a2821c3c3d5be4f2b32bc404b920698d5281 (diff)
Sitemaps: split and index, add package files
Split it up as it is growing rather large, and add all the package files views to the mix so Google or anyone can pick those up. They get a slightly lower priority (if that even matters). Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitemaps.py13
-rw-r--r--urls.py13
2 files changed, 20 insertions, 6 deletions
diff --git a/sitemaps.py b/sitemaps.py
index 256f7101..25b48c68 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -3,7 +3,7 @@ from main.models import Package, News
class PackagesSitemap(Sitemap):
changefreq = "monthly"
- priority = "0.4"
+ priority = "0.5"
def items(self):
return Package.objects.select_related('arch', 'repo').all()
@@ -12,6 +12,17 @@ class PackagesSitemap(Sitemap):
def lastmod(self, obj):
return obj.last_update
+
+class PackageFilesSitemap(PackagesSitemap):
+ priority = "0.3"
+
+ def location(self, obj):
+ return PackagesSitemap.location(self, obj) + 'files/'
+
+ def lastmod(self, obj):
+ return obj.files_last_update
+
+
class NewsSitemap(Sitemap):
changefreq = "never"
priority = "0.7"
diff --git a/urls.py b/urls.py
index e53d918a..72d83d54 100644
--- a/urls.py
+++ b/urls.py
@@ -8,17 +8,18 @@ from django.contrib.auth.decorators import permission_required
from main.models import Todolist
from feeds import PackageFeed, NewsFeed
-from sitemaps import NewsSitemap, PackagesSitemap
+from sitemaps import NewsSitemap, PackagesSitemap, PackageFilesSitemap
feeds = {
+ 'news': NewsFeed,
'packages': PackageFeed,
- 'news': NewsFeed
}
sitemaps = {
- 'news': NewsSitemap,
- 'packages': PackagesSitemap,
+ 'news': NewsSitemap,
+ 'packages': PackagesSitemap,
+ 'package-files': PackageFilesSitemap,
}
admin.autodiscover()
@@ -82,7 +83,9 @@ urlpatterns = patterns('',
(r'^feeds/$', 'public.views.feeds'),
(r'^feeds/(?P<url>.*)/$',
'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
- (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap',
+ (r'^sitemap.xml$', 'django.contrib.sitemaps.views.index',
+ {'sitemaps': sitemaps}),
+ (r'^sitemap-(?P<section>.+)\.xml$', 'django.contrib.sitemaps.views.sitemap',
{'sitemaps': sitemaps}),
# Authentication / Admin