summaryrefslogtreecommitdiff
path: root/pgweb/news/struct.py
diff options
context:
space:
mode:
authorMagnus Hagander2011-07-12 13:17:29 +0000
committerMagnus Hagander2011-07-12 13:17:29 +0000
commit2ca2b86b231c7516d91cb46f70f48d082bb8f120 (patch)
tree21b19281ab7f5e911434df26a2a3dbf24d85fa01 /pgweb/news/struct.py
parent2473db4910986a9da0b6fc6ac3a364e57313315e (diff)
Only index news items 4 years or younger
Diffstat (limited to 'pgweb/news/struct.py')
-rw-r--r--pgweb/news/struct.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pgweb/news/struct.py b/pgweb/news/struct.py
index 704dd875..e1112aa5 100644
--- a/pgweb/news/struct.py
+++ b/pgweb/news/struct.py
@@ -1,14 +1,16 @@
import os
-from datetime import date
+from datetime import date, timedelta
from models import NewsArticle
def get_struct():
now = date.today()
+ fouryearsago = date.today() - timedelta(4*365, 0, 0)
# We intentionally don't put /about/newsarchive/ in the sitemap,
# since we don't care about getting it indexed.
+ # Also, don't bother indexing anything > 4 years old
- for n in NewsArticle.objects.filter(approved=True):
+ for n in NewsArticle.objects.filter(approved=True, date__gt=fouryearsago):
yearsold = (now - n.date).days / 365
if yearsold > 4:
yearsold = 4