Serve feeds as application/xml so browsers render instead of download

Also add target=_blank to subscribe page feed links.
This commit is contained in:
russell@unturf.com 2026-02-08 14:24:45 -05:00
parent 95e90f0ed8
commit 5ee2175a3f
2 changed files with 6 additions and 6 deletions

View file

@ -123,9 +123,9 @@
<div class="subscribe-feeds">
<b>Other Ways to Follow</b>
<p>
<a href="/rss.xml" class="shop-theme-link-color">RSS Feed</a>
<a href="/rss.xml" target="_blank" class="shop-theme-link-color">RSS Feed</a>
&nbsp;|&nbsp;
<a href="/atom.xml" class="shop-theme-link-color">Atom Feed</a>
<a href="/atom.xml" target="_blank" class="shop-theme-link-color">Atom Feed</a>
</p>
</div>

View file

@ -228,14 +228,14 @@ def rss_view(request):
if not shop:
response = Response(body="<?xml version='1.0' encoding='UTF-8'?><rss version='2.0'><channel></channel></rss>")
response.content_type = "application/rss+xml"
response.content_type = "application/xml"
return response
products, content = get_public_items(shop)
xml = build_rss_xml(request, shop, products, content)
response = Response(body=f"<?xml version='1.0' encoding='UTF-8'?>\n{xml}")
response.content_type = "application/rss+xml"
response.content_type = "application/xml"
return response
@ -247,12 +247,12 @@ def atom_view(request):
if not shop:
response = Response(body="<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom'></feed>")
response.content_type = "application/atom+xml"
response.content_type = "application/xml"
return response
products, content = get_public_items(shop)
xml = build_atom_xml(request, shop, products, content)
response = Response(body=f"<?xml version='1.0' encoding='UTF-8'?>\n{xml}")
response.content_type = "application/atom+xml"
response.content_type = "application/xml"
return response