stephenmcd/mezzanine — Issue #100: Blog post list template breaks document structure with description_from_content
Author: derkaderka
Created: 2011-10-21 00:17:46+00:00
State: open

The template used to render blog post lists (blog/templates/blog_post_list.html) uses the description_from_content method (marking the value resulting as |safe) without verifying that no markup was actually broken inside:

{% editable blog_post.content %}
{{ blog_post.description_from_content|safe}}
{% endeditable %}

This causes trouble whenever the blog post contains HTML markup. The easiest solution would be to either use escaped output (preferably stripping tags) like so:

{% editable blog_post.content %}
{{ blog_post.description_from_content|striptags|safe}}
{% endeditable %}

I would of course suggest using something more friendly than making the post "excerpt" entirely free of markup, but this helps already.