Open pepelsbey opened 3 weeks ago
XML-ify your HTML into
and remove the CDATA
You lost me at this part—can you elaborate? 🫣
Oop, I just got it after I posted the comment, nevermind!
Cross referencing this posthtml plugin option for closingSingleTag
, which is exposed in the plugin! https://github.com/11ty/eleventy-plugin-rss/blob/f6a88ada303e9f69b5982274362fdf177f209954/.eleventy.js#L29C7-L29C32
I think the secret sauce may lie in Nunjucks escaping of the HTML though:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Zach Leatherman</title>
<subtitle>A web development blog written by @zachleat.</subtitle>
<link href="https://www.zachleat.com/web/feed/" rel="self"/>
<link href="https://www.zachleat.com/web/"/>
<updated>2024-05-31T00:00:00Z</updated>
<id>http://www.zachleat.com/</id>
<author>
<name>Zach Leatherman</name>
<email>zachleat@zachleat.com</email>
</author>
<entry>
<title>11ty Goes Fully Independent—JS Party #325</title>
<link href="https://www.zachleat.com/web/jsparty-indie-11ty/"/>
<updated>2024-05-31T00:00:00Z</updated>
<id>http://www.zachleat.com/web/jsparty-indie-11ty/</id>
<content type="html">
<p>I was on the JS Party podcast to talk about the <a href="https://www.zachleat.com/web/independent-sustainable-11ty/">push to make 11ty independent and sustainability in 2024</a>!</p>
<blockquote>
<p>11ty creator Zach Leatherman is taking the open source site generator fully independent in 2024 and he’s back on the pod to tell us why, how &amp; what we all can do to help.</p>
</blockquote>
<p>I’ve been blown away by the response so far, y’all are amazing. At time of this post we’re currently at 56% of the goal.</p>
<a href="https://opencollective.com/11ty">
<fundraising-status min="0" max="6000" value="3486.69" style="--fs-color: #e23c2f;">
<img src="https://v1.indieweb-avatar.11ty.dev/https%3A%2F%2Fwww.11ty.dev%2F/" width="30" height="30" alt="11ty Logo" loading="lazy" decoding="async" />
</fundraising-status>
</a>
<p><em>(The above graph will update daily with the current status.)</em></p>
<hr />
<p>Listen at <a href="https://changelog.com/jsparty/325"><code>https://changelog.com/jsparty/325</code></a> or below:</p>
<iframe loading="lazy" src="https://changelog.com/jsparty/325/embed?theme=night" width="100%" height="220" scrolling="no" frameborder="no"></iframe>
<h2 id="even-more-jsparty:" tabindex="-1">Even More JSParty: <a class="direct-link" href="https://www.zachleat.com/web/jsparty-indie-11ty/#even-more-jsparty:" aria-hidden="true">#</a></h2>
<ul>
<li><a href="https://www.zachleat.com/web/jsparty-eleventy-2/">Celebrating Eleventy 2.0 🎉—JS Party #266</a></li>
<li><a href="https://www.zachleat.com/web/jsparty-eleventy/">Going full-time on Eleventy—JS Party #217</a></li>
<li><a href="https://www.zachleat.com/web/jsparty/">Spicy fonts and static sites 🌶️—JS Party #79</a></li>
</ul>
</content>
</entry>
</feed>
The above entry works as expected with <img/>
or <img>
and an --fs-color: #e23c2f;
in there too.
This is the default behavior in the new virtual template method provided in this plugin (#47)
Other solutions might also exist
They exist, indeed!
I wonder how RSS readers are treating such escaped HTML, though.
(a feature request)
I’m generating article feeds using Eleventy, and I constantly have to deal with a problem:
<img>
, you need to wrap the content into<!--[CDATA[ … ]]-->
to get valid XML.var(--color-grey-dark)
, your feed becomes invalid because you can’t have--
inside CDATA since it’s an XML comment.Here’s an example feed with such an error: web-standards.ru/articles/feed
The simplest solution would be to XML-ify your HTML into
<img/>
and remove the CDATA. I learned it from the @zachleat’s feed. Other solutions might also exist.Anyway, I think Eleventy’s feed plugin could also help us with that 😉