summaryrefslogtreecommitdiff
path: root/packages/astro-rss/src
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-03-13 17:34:23 -0400
committerGravatar GitHub <noreply@github.com> 2023-03-13 17:34:23 -0400
commit400ef26c998a586b29c2f3931e63c1c5801d3bea (patch)
treecba2b363f228f29f35f4123a8a63716a1d8a1b1d /packages/astro-rss/src
parent43daac7a9b4cc793369bbeb3f722f8de9d8f64c8 (diff)
downloadastro-400ef26c998a586b29c2f3931e63c1c5801d3bea.tar.gz
astro-400ef26c998a586b29c2f3931e63c1c5801d3bea.tar.zst
astro-400ef26c998a586b29c2f3931e63c1c5801d3bea.zip
[RSS] Fix: Preserve self-closing tags in `customData` (#6538)
* fix: preserve self-closing tags in customData * test: self-closing tags preserved * chore: changeset
Diffstat (limited to 'packages/astro-rss/src')
-rw-r--r--packages/astro-rss/src/index.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index 35bf5f613..7764b5d13 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -142,7 +142,13 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
? rssOptions.items
: rssOptions.items.filter((item) => !item.draft);
- const xmlOptions = { ignoreAttributes: false };
+ const xmlOptions = {
+ ignoreAttributes: false,
+ // Avoid correcting self-closing tags to standard tags
+ // when using `customData`
+ // https://github.com/withastro/astro/issues/5794
+ suppressEmptyNode: true,
+ };
const parser = new XMLParser(xmlOptions);
const root: any = { '?xml': { '@_version': '1.0', '@_encoding': 'UTF-8' } };
if (typeof rssOptions.stylesheet === 'string') {