fix(rss): Links to stylsheets

This commit is contained in:
moanos [he/him] 2024-04-16 00:18:47 +02:00
parent 32e82d7eed
commit 045086aaef
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
from django.contrib.syndication.views import Feed from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed from django.utils.feedgenerator import Rss201rev2Feed
from django.templatetags.static import static
from django.urls import reverse from django.urls import reverse
from django.utils.xmlutils import SimplerXMLGenerator from django.utils.xmlutils import SimplerXMLGenerator
@ -15,7 +16,7 @@ class FormattedFeed(Rss201rev2Feed):
def write(self, outfile, encoding): def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding, short_empty_elements=True) handler = SimplerXMLGenerator(outfile, encoding, short_empty_elements=True)
handler.startDocument() handler.startDocument()
handler._write('<?xml-stylesheet href="/static/rss.xsl" type="text/xsl"?>') handler._write(f'<?xml-stylesheet href="{static("rss.xsl")}" type="text/xsl"?>')
handler.startElement("rss", self.rss_attributes()) handler.startElement("rss", self.rss_attributes())
handler.startElement("channel", self.root_attributes()) handler.startElement("channel", self.root_attributes())
self.add_root_elements(handler) self.add_root_elements(handler)

View File

@ -12,7 +12,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="css/rss-styles.css"/> <link rel="stylesheet" type="text/css" href="/static/fellchensammlung/css/rss-styles.css"/>
</head> </head>
<body> <body>
<main> <main>