Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions blog/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,20 @@ def test_draft_items_not_in_feeds(self):
self.assertContains(response6, draft_entry.title)
self.assertContains(response6, draft_blogmark.link_title)
self.assertContains(response6, draft_quotation.source)

def test_og_description_strips_markdown(self):
blogmark = BlogmarkFactory(commentary="This **has** *markdown*", use_markdown=True)
response = self.client.get(blogmark.get_absolute_url())
self.assertContains(
response,
'<meta property="og:description" content="This has markdown"',
html=False,
)

note = NoteFactory(body="A note with **bold** text")
response2 = self.client.get(note.get_absolute_url())
self.assertContains(
response2,
'<meta property="og:description" content="A note with bold text"',
html=False,
)
2 changes: 1 addition & 1 deletion templates/blogmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block card_title %}{{ blogmark.link_title|typography }}{% endblock %}
{% block card_description %}{{ blogmark.commentary|truncatewords:30 }}{% endblock %}
{% block card_description %}{{ blogmark.body|striptags|truncatewords:30 }}{% endblock %}

{% block item_content %}
{% include "_draft_warning.html" %}
Expand Down
2 changes: 1 addition & 1 deletion templates/note.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% endblock %}

{% block card_title %}{% if note.title %}{{ note.title }}{% else %}Note on {{ note.created|date:"jS F Y" }}{% endif %}{% endblock %}
{% block card_description %}{{ note.body|truncatewords:30 }}{% endblock %}
{% block card_description %}{{ note.body_rendered|striptags|truncatewords:30 }}{% endblock %}

{% load entry_tags %}
{% block item_content %}
Expand Down