Fixed broken format strings in RSS feed route

This commit is contained in:
Fabio Manganiello 2023-05-08 12:10:15 +02:00
parent 34b187d0d4
commit 958f4106cc

View file

@ -115,8 +115,12 @@ def article_route(article: str):
@app.route("/rss", methods=["GET"]) @app.route("/rss", methods=["GET"])
def rss_route(): def rss_route():
pages = app.get_pages(with_content=True, skip_header=True, skip_html_head=True) short_description = "short" in request.args or config.short_feed
short_description = "short" in request.args pages = app.get_pages(
with_content=not short_description,
skip_header=True,
skip_html_head=True,
)
return Response( return Response(
"""<?xml version="1.0" encoding="UTF-8" ?> """<?xml version="1.0" encoding="UTF-8" ?>
@ -149,20 +153,17 @@ def rss_route():
), ),
items="\n\n".join( items="\n\n".join(
[ [
""" (
"""
<item> <item>
<title>{title}</title> <title>{title}</title>
<link>{base_link}{link}</link> <link>{base_link}{link}</link>
<pubDate>{published}</pubDate>""" <pubDate>{published}</pubDate>
+ ( <description><![CDATA[{content}]]></description>
"<description><![CDATA[{content}]]></description>"
if not config.short_feed
else ""
)
+ """
<media:content medium="image" url="{base_link}{image}" width="200" height="150" /> <media:content medium="image" url="{base_link}{image}" width="200" height="150" />
</item> </item>
""".format( """
).format(
base_link=config.link, base_link=config.link,
title=page.get("title", "[No Title]"), title=page.get("title", "[No Title]"),
link=page.get("uri", ""), link=page.get("uri", ""),