From 96a7614285325b693434f3fd011238000d75926d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 8 Nov 2014 16:31:38 -0600 Subject: Add a news-specific sitemap This follows the spec at https://support.google.com/news/publisher/answer/74288?hl=en#tagdefinitions Signed-off-by: Dan McGee --- sitemaps.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sitemaps.py') diff --git a/sitemaps.py b/sitemaps.py index eb4e05d9..fb81357e 100644 --- a/sitemaps.py +++ b/sitemaps.py @@ -98,6 +98,13 @@ class NewsSitemap(Sitemap): return 'yearly' +class RecentNewsSitemap(NewsSitemap): + def items(self): + now = datetime.utcnow().replace(tzinfo=utc) + cutoff = now - timedelta(days=30) + return super(RecentNewsSitemap, self).items().filter(postdate__gte=cutoff) + + class ReleasesSitemap(Sitemap): changefreq = "monthly" -- cgit v1.2.2