summaryrefslogtreecommitdiff
path: root/packages/astro-rss/src
diff options
context:
space:
mode:
authorGravatar Frode Flaten <3436158+fflaten@users.noreply.github.com> 2022-12-14 14:39:48 +0100
committerGravatar GitHub <noreply@github.com> 2022-12-14 08:39:48 -0500
commitc4155daeabe1b8191ad9ed1fa5893759f1fe5c4c (patch)
tree447042aca45a45099906d2cd685641d61a691914 /packages/astro-rss/src
parentd7da0996b6b80499a6f8f2c86a5cfc3e39f741d2 (diff)
downloadastro-c4155daeabe1b8191ad9ed1fa5893759f1fe5c4c.tar.gz
astro-c4155daeabe1b8191ad9ed1fa5893759f1fe5c4c.tar.zst
astro-c4155daeabe1b8191ad9ed1fa5893759f1fe5c4c.zip
fix missing type-attribute for xsl stylesheets (#5600)
Diffstat (limited to 'packages/astro-rss/src')
-rw-r--r--packages/astro-rss/src/index.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index 4d87586c3..3bac3feb2 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -104,7 +104,8 @@ export async function generateRSS({ rssOptions, items }: GenerateRSSArgs): Promi
const parser = new XMLParser(xmlOptions);
const root: any = { '?xml': { '@_version': '1.0', '@_encoding': 'UTF-8' } };
if (typeof rssOptions.stylesheet === 'string') {
- root['?xml-stylesheet'] = { '@_href': rssOptions.stylesheet, '@_encoding': 'UTF-8' };
+ const isXSL = /\.xsl$/i.test(rssOptions.stylesheet);
+ root['?xml-stylesheet'] = { '@_href': rssOptions.stylesheet, ...(isXSL && { '@_type': 'text/xsl' }) };
}
root.rss = { '@_version': '2.0' };
if (items.find((result) => result.content)) {