Skip to content

Commit ad2910a

Browse files
committed
Handle abstract_chars_count set to 0
1 parent e1951f8 commit ad2910a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mkdocs_rss_plugin/util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,14 @@ def get_description_or_abstract(self, in_page: Page, chars_count: int = 160) ->
366366
# return the description.
367367
if description and chars_count is not None:
368368
return description
369+
# If no description and chars_count set to 0, return empty string
370+
elif not description and chars_count == 0:
371+
logger.warning(
372+
f"[rss-plugin] No description set for page {in_page.file} "
373+
"and 'abstract_chars_count' set to 0. The feed won't be compliant, "
374+
"because an item must have a description."
375+
)
376+
return ""
369377
# If chars count is unlimited, use the html content
370378
elif in_page.content and chars_count is None:
371379
if chars_count is None or len(in_page.content) < chars_count:

0 commit comments

Comments
 (0)