#Prevent adding closing slash to an *empty* tag
3 messages · Page 1 of 1 (latest)
Hi @true cape. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the provided knowledge sources, there isn't a direct way to prevent Astro from adding a closing slash to an empty tag. However, there was a similar issue reported on Github where empty elements set in customData were converted to use closing tags. The proposed solution was to include suppressEmptyNode: true in the xmlOptions used with XMLParser and XMLBuilder. This might not directly apply to your case, but it could be a starting point for further investigation.
Here is the relevant extract from the knowledge source:
Empty elements set in `customData` are converted to use closing tag.
Ex:
`customData: '<atom:link href="${import.meta.env.SITE}rss.xml" rel="self" type="application/rss+xml" />'`
becomes:
`&lt;atom:link href=&quot;<https://domain.com/rss.xml&quot;> rel=&quot;self&quot; type=&quot;application/rss+xml&quot;&gt;&lt;/atom:link&gt;`
**Possible solution**
Including `suppressEmptyNode: true` in the `xmlOptions` used with `XMLParser` and `XMLBuilder` fixes this. Any downsides?
(Source: Github Issue (closed): [astro-rss] Forced closing tags in customData > Original post (https://github.com/withastro/astro/issues/5794))