From f72d06a4a5271d1a4156ef042f307a479dd7b452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Gardini?= Date: Fri, 26 Apr 2019 20:11:37 -0300 Subject: [PATCH] Adds the category to the feed item. Fix #2556. Adds the article category as a feed item category. --- pelican/writers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pelican/writers.py b/pelican/writers.py index bdaabd8d..b610e2e2 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -78,13 +78,19 @@ class Writer(object): if description == content: description = None + categories = list() + if hasattr(item, 'category'): + categories.append(item.category) + if hasattr(item, 'tags'): + categories.extend(item.tags) + feed.add_item( title=title, link=link, unique_id=get_tag_uri(link, item.date), description=description, content=content, - categories=item.tags if hasattr(item, 'tags') else None, + categories=categories if categories else None, author_name=getattr(item, 'author', ''), pubdate=set_date_tzinfo( item.date, self.settings.get('TIMEZONE', None)),