forked from github/pelican
Related posts is now working, but needs some actual logic.
This commit is contained in:
parent
dc21efbe10
commit
ddc0aa0e82
1 changed files with 8 additions and 1 deletions
|
|
@ -116,6 +116,7 @@ class ArticlesGenerator(Generator):
|
||||||
self.dates = {}
|
self.dates = {}
|
||||||
self.tags = defaultdict(list)
|
self.tags = defaultdict(list)
|
||||||
self.categories = defaultdict(list)
|
self.categories = defaultdict(list)
|
||||||
|
self.related_posts = []
|
||||||
self.authors = defaultdict(list)
|
self.authors = defaultdict(list)
|
||||||
super(ArticlesGenerator, self).__init__(*args, **kwargs)
|
super(ArticlesGenerator, self).__init__(*args, **kwargs)
|
||||||
self.drafts = []
|
self.drafts = []
|
||||||
|
|
@ -344,8 +345,14 @@ class ArticlesGenerator(Generator):
|
||||||
self.authors = list(self.authors.items())
|
self.authors = list(self.authors.items())
|
||||||
self.authors.sort(key=lambda item: item[0].name)
|
self.authors.sort(key=lambda item: item[0].name)
|
||||||
|
|
||||||
|
for article in self.articles:
|
||||||
|
article.related_posts = []
|
||||||
|
print article
|
||||||
|
potential_related = all_articles.remove(article)
|
||||||
|
article.related_posts = potential_related[:5]
|
||||||
|
|
||||||
self._update_context(('articles', 'dates', 'tags', 'categories',
|
self._update_context(('articles', 'dates', 'tags', 'categories',
|
||||||
'tag_cloud', 'authors'))
|
'tag_cloud', 'authors', 'related_posts'))
|
||||||
|
|
||||||
def generate_output(self, writer):
|
def generate_output(self, writer):
|
||||||
self.generate_feeds(writer)
|
self.generate_feeds(writer)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue