Skip to content

Commit 8f6b278

Browse files
authored
Add subscribe note to entries feed (#539)
1 parent d50c939 commit 8f6b278

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

blog/feeds.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ def item_title(self, item):
5757
return item.title
5858

5959
def item_description(self, item):
60-
return item.body
60+
note = (
61+
'<p><em>You are only seeing the long-form articles from my blog. '
62+
'Subscribe to <a href="https://simonwillison.net/atom/everything/">/atom/everything/</a> '
63+
'to get all of my posts, or take a look at my <a href="https://simonwillison.net/about/#subscribe">other subscription options</a>.</em></p>'
64+
)
65+
return item.body + note
6166

6267

6368
class Blogmarks(Base):

blog/tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,14 @@ def test_draft_items_not_in_feeds(self):
287287
self.assertContains(response6, draft_blogmark.link_title)
288288
self.assertContains(response6, draft_quotation.source)
289289

290+
def test_entries_feed_includes_subscribe_note(self):
291+
EntryFactory()
292+
response = self.client.get("/atom/entries/")
293+
self.assertIn(
294+
"You are only seeing the",
295+
response.content.decode(),
296+
)
297+
290298
def test_og_description_strips_markdown(self):
291299
blogmark = BlogmarkFactory(commentary="This **has** *markdown*", use_markdown=True)
292300
response = self.client.get(blogmark.get_absolute_url())

0 commit comments

Comments
 (0)