From a7d34bc522ae6231da5456b95a72aa7e9380e1e1 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 18 Aug 2020 15:29:08 +0000 Subject: [PATCH] RSS: Change feed to Atom format RSS does not allow to not have an email address for authors which we do not have for imported feeds. Signed-off-by: Michael Tremer --- src/templates/blog/base.html | 2 +- src/templates/blog/feed.xml | 59 +++++++++++++++--------------------- src/templates/index.html | 2 +- src/web/blog.py | 4 +-- 4 files changed, 28 insertions(+), 39 deletions(-) diff --git a/src/templates/blog/base.html b/src/templates/blog/base.html index 723d7024..14f7576f 100644 --- a/src/templates/blog/base.html +++ b/src/templates/blog/base.html @@ -1,7 +1,7 @@ {% extends "../base.html" %} {% block head %} - + {% block meta %}{% end block %} {% end block %} diff --git a/src/templates/blog/feed.xml b/src/templates/blog/feed.xml index 1796d3d0..98fe72e6 100644 --- a/src/templates/blog/feed.xml +++ b/src/templates/blog/feed.xml @@ -2,43 +2,32 @@ {% import ipfire.accounts as accounts %} - - - IPFire Blog - - https://blog.ipfire.org - The official blog of the IPFire Project - {{ now }} - en-GB - hourly - 1 + + https://blog.ipfire.org/feed.xml - - https://www.ipfire.org{{ static_url("img/tux/ipfire_tux_32x32.png") }} - IPFire Blog - https://blog.ipfire.org - 32 - 32 - + + + - + IPFire Blog + The official blog of the IPFire Project + https://www.ipfire.org{{ static_url("img/tux/ipfire_tux_32x32.png") }} + {{ now.isoformat() }}Z - {% for post in posts %} - - {{ post.title }} - https://blog.ipfire.org/post/{{ post.slug }} + {% for post in posts %} + + https://blog.ipfire.org/post/{{ post.slug }} + {{ post.title }} + + + {{ post.author }} {% if isinstance(post.author, accounts.Account) %} - {{ post.author.email }} ({{ post.author.name }}) - {% else %} - {{ post.author }} + {{ post.author.email }} {% end %} - {{ post.published_at.strftime("%a, %d %b %Y %H:%M:%S +0200") }} - https://blog.ipfire.org/post/{{ post.slug }} - - - {% end %} - - + + {{ post.published_at.isoformat() }}Z + {{ post.updated_at.isoformat() }}Z + + + {% end %} + diff --git a/src/templates/index.html b/src/templates/index.html index f668b01b..17520e3b 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -2,7 +2,7 @@ {% block head %} - + {% end block %} {% block title %}{{ _("Welcome to IPFire") }}{% end block %} diff --git a/src/web/blog.py b/src/web/blog.py index 13d414e5..ff90bdd0 100644 --- a/src/web/blog.py +++ b/src/web/blog.py @@ -48,11 +48,11 @@ class FeedHandler(base.BaseHandler): self.set_expires(600) # Set correct content type - self.set_header("Content-Type", "application/rss+xml") + self.set_header("Content-Type", "application/atom+xml") # Render the feed self.render("blog/feed.xml", posts=posts, - now=email.utils.formatdate()) + now=datetime.datetime.now()) class PostHandler(auth.CacheMixin, base.BaseHandler): -- 2.47.3