diff --git a/src/content/models.py b/src/content/models.py index 680d162b5..bec5325c5 100644 --- a/src/content/models.py +++ b/src/content/models.py @@ -51,8 +51,8 @@ ] -def strip_tags_with_spaces(string): - spaced = string.replace("><", "> <") +def strip_tags_with_newlines(string): + spaced = string.replace("><", ">\n<") return strip_tags(spaced) @@ -504,7 +504,7 @@ def _generate_excerpt(self): [str(b.value) for b in self.body if b.block_type == "text_section"] ) self.excerpt = truncate_words_and_chars( - text=html.unescape(strip_tags_with_spaces(content)), + text=html.unescape(strip_tags_with_newlines(content)), ) def save(self, *args, **kwargs):