Skip to content

Commit

Permalink
Add content to entries in atom feed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparrow0hawk committed Aug 11, 2024
1 parent 84b1205 commit 94084f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/blog/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ def _build_post_entries(self, feed: Element) -> None:
SubElement(entry, "id").text = f"{self.link}posts/{post.filename}.html"
SubElement(entry, "link", attrib={"href": f"{self.link}posts/{post.filename}.html", "rel": "alternate"})
SubElement(entry, "updated").text = post.publish_date.strftime("%Y-%m-%dT%H:%M:%SZ")
SubElement(entry, "content", attrib={"type": "html"}).text = post.content
3 changes: 2 additions & 1 deletion tests/test_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_build() -> None:
post = Post(
filename="2024-08-01-hello_world",
title="Hello World",
content="Hello world!",
content="<p>Hello world!</p>",
publish_date=datetime(2024, 8, 1),
)
feed.add_post(post)
Expand All @@ -32,6 +32,7 @@ def test_build() -> None:
<id>https://hello.blog/posts/2024-08-01-hello_world.html</id>
<link href="https://hello.blog/posts/2024-08-01-hello_world.html" rel="alternate" />
<updated>2024-08-01T00:00:00Z</updated>
<content type="html">&lt;p&gt;Hello world!&lt;/p&gt;</content>
</entry>
</feed>"""
)
Expand Down

0 comments on commit 94084f2

Please sign in to comment.