feat: added related articles
This commit is contained in:
@@ -179,6 +179,7 @@ class ArticleTranslation:
|
||||
]
|
||||
|
||||
self.linked_context = self.context["linked"] = []
|
||||
self.related_context = self.context["related"] = []
|
||||
|
||||
def __init_content_context__(self):
|
||||
template = jinja2.Template(self.html_content)
|
||||
@@ -197,6 +198,9 @@ class ArticleTranslation:
|
||||
if self.language_code in a.article_translations_map:
|
||||
self.linked_context.append(a.article_translations_map[self.language_code].context)
|
||||
|
||||
self.related_context.extend(self.linked_context)
|
||||
self.related_context.extend(self.context["children"])
|
||||
|
||||
self.context["content"] = self.html_content
|
||||
self.context["preview"] = get_preview_text(html_string=self.html_content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user