diff options
author | 2022-12-14 14:39:48 +0100 | |
---|---|---|
committer | 2022-12-14 08:39:48 -0500 | |
commit | c4155daeabe1b8191ad9ed1fa5893759f1fe5c4c (patch) | |
tree | 447042aca45a45099906d2cd685641d61a691914 /packages/astro-rss/src | |
parent | d7da0996b6b80499a6f8f2c86a5cfc3e39f741d2 (diff) | |
download | astro-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.ts | 3 |
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)) { |