File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -286,3 +286,20 @@ def test_draft_items_not_in_feeds(self):
286
286
self .assertContains (response6 , draft_entry .title )
287
287
self .assertContains (response6 , draft_blogmark .link_title )
288
288
self .assertContains (response6 , draft_quotation .source )
289
+
290
+ def test_og_description_strips_markdown (self ):
291
+ blogmark = BlogmarkFactory (commentary = "This **has** *markdown*" , use_markdown = True )
292
+ response = self .client .get (blogmark .get_absolute_url ())
293
+ self .assertContains (
294
+ response ,
295
+ '<meta property="og:description" content="This has markdown"' ,
296
+ html = False ,
297
+ )
298
+
299
+ note = NoteFactory (body = "A note with **bold** text" )
300
+ response2 = self .client .get (note .get_absolute_url ())
301
+ self .assertContains (
302
+ response2 ,
303
+ '<meta property="og:description" content="A note with bold text"' ,
304
+ html = False ,
305
+ )
Original file line number Diff line number Diff line change 9
9
{% endblock %}
10
10
11
11
{% block card_title %}{{ blogmark.link_title|typography }}{% endblock %}
12
- {% block card_description %}{{ blogmark.commentary |truncatewords:30 }}{% endblock %}
12
+ {% block card_description %}{{ blogmark.body|striptags |truncatewords:30 }}{% endblock %}
13
13
14
14
{% block item_content %}
15
15
{% include "_draft_warning.html" %}
Original file line number Diff line number Diff line change 8
8
{% endblock %}
9
9
10
10
{% block card_title %}{% if note.title %}{{ note.title }}{% else %}Note on {{ note.created|date:"jS F Y" }}{% endif %}{% endblock %}
11
- {% block card_description %}{{ note.body |truncatewords:30 }}{% endblock %}
11
+ {% block card_description %}{{ note.body_rendered|striptags |truncatewords:30 }}{% endblock %}
12
12
13
13
{% load entry_tags %}
14
14
{% block item_content %}
You can’t perform that action at this time.
0 commit comments