summaryrefslogtreecommitdiff
path: root/sitemaps.py
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 17:42:33 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 17:42:33 -0500
commit8844fd0c6361d3a6ccd88647276e9af0e6cd64d2 (patch)
tree7615c29fe200a3c7be748d3d40ea35628ce9cd39 /sitemaps.py
parentc0d6f0711c4760f08a6beb99818d075d7c993e2e (diff)
parentea87160c397fe1daf63851f0ed0be146bea79196 (diff)
Merge commit 'ea87160' (update)
Diffstat (limited to 'sitemaps.py')
-rw-r--r--sitemaps.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/sitemaps.py b/sitemaps.py
index 958d1f44..177555ff 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -1,3 +1,5 @@
+from datetime import datetime, timedelta
+
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
@@ -17,8 +19,8 @@ class PackagesSitemap(Sitemap):
class PackageFilesSitemap(PackagesSitemap):
- changefreq = "monthly"
- priority = "0.3"
+ changefreq = "weekly"
+ priority = "0.2"
def location(self, obj):
return PackagesSitemap.location(self, obj) + 'files/'
@@ -57,15 +59,26 @@ class SplitPackagesSitemap(Sitemap):
class NewsSitemap(Sitemap):
- changefreq = "never"
priority = "0.8"
+ def __init__(self):
+ now = datetime.utcnow()
+ self.one_day_ago = now - timedelta(days=1)
+ self.one_week_ago = now - timedelta(days=7)
+
def items(self):
return News.objects.all()
def lastmod(self, obj):
return obj.last_modified
+ def changefreq(self, obj):
+ if obj.last_modified > self.one_day_ago:
+ return 'daily'
+ if obj.last_modified > self.one_week_ago:
+ return 'weekly'
+ return 'yearly'
+
class BaseSitemap(Sitemap):
base_viewnames = (