forked from github/pelican
Fix #12
This commit is contained in:
parent
a3f0ded146
commit
5fda51de42
2 changed files with 6 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,9 @@
|
|||
<h1>Archives for {{ SITENAME }}</h1>
|
||||
|
||||
<dl>
|
||||
{% for date, articles in dates %}
|
||||
{% for article in articles %}
|
||||
<dt>{{ date }}</dt>
|
||||
<dd><a href='{{ article.url }}'>{{ article.title }}</a></dd>
|
||||
{% endfor %}
|
||||
{% for article in dates %}
|
||||
<dt>{{ article.date.strftime('%a %d %B %Y') }}</dt>
|
||||
<dd><a href='{{ article.url }}'>{{ article.title }}</a></dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue