From 5fda51de423012d38977b6bee48b03f11f708815 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 26 Nov 2010 23:37:03 +0000 Subject: [PATCH] Fix #12 --- pelican/processors.py | 8 +++----- pelican/themes/notmyidea/templates/archives.html | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pelican/processors.py b/pelican/processors.py index 63843030..d35abdbf 100644 --- a/pelican/processors.py +++ b/pelican/processors.py @@ -27,7 +27,6 @@ class ArticlesProcessor(Processor): def __init__(self, settings=None): self.articles = [] self.dates = {} - self.years = {} self.tags = {} self.categories = {} @@ -82,8 +81,6 @@ class ArticlesProcessor(Processor): if not is_valid_content(article, f): continue - update_dict(self.dates, article.date.strftime('%Y-%m-%d'), article) - update_dict(self.years, article.date.year, article) update_dict(self.categories, article.category, article) if hasattr(article, 'tags'): for tag in article.tags: @@ -92,9 +89,10 @@ class ArticlesProcessor(Processor): # sort the articles by date self.articles.sort(key=attrgetter('date'), reverse=True) + self.dates = self.articles + self.dates.sort(key=attrgetter('date')) # and generate the output :) - self._update_context(context, ('articles', 'dates', 'years', - 'tags', 'categories')) + self._update_context(context, ('articles', 'dates', 'tags', 'categories')) def process(self, context, generator): self.generate_feeds(context, generator) diff --git a/pelican/themes/notmyidea/templates/archives.html b/pelican/themes/notmyidea/templates/archives.html index b3e534b7..1644affb 100644 --- a/pelican/themes/notmyidea/templates/archives.html +++ b/pelican/themes/notmyidea/templates/archives.html @@ -4,11 +4,9 @@

Archives for {{ SITENAME }}

-{% for date, articles in dates %} - {% for article in articles %} -
{{ date }}
-
{{ article.title }}
- {% endfor %} +{% for article in dates %} +
{{ article.date.strftime('%a %d %B %Y') }}
+
{{ article.title }}
{% endfor %}