diff options
author | 2023-03-13 17:34:23 -0400 | |
---|---|---|
committer | 2023-03-13 17:34:23 -0400 | |
commit | 400ef26c998a586b29c2f3931e63c1c5801d3bea (patch) | |
tree | cba2b363f228f29f35f4123a8a63716a1d8a1b1d /packages/astro-rss/src | |
parent | 43daac7a9b4cc793369bbeb3f722f8de9d8f64c8 (diff) | |
download | astro-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.ts | 8 |
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') { |