summaryrefslogtreecommitdiff
path: root/packages/astro-rss/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro-rss/src/index.ts')
-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)) {