Closed barcia closed 2 years ago
What xml is this? As far as I know, we don't use xml in Eleventy nor parse it for data
Sorry, I am not explain right … I generate a feed.xml
from feed.njk
(as is showed in the sample). With my content, the resulting feed.xml
does not show up well in the browser. Show the error commented above.
In barcia.dev/feed.xml you can see the error.
From what I have seen, this is caused by the content. In this StackOverflow thread speak about it.
If I can solve it, I put it here.
I finally solved my problem.
I am doing it adding a filter to my content.
Put the filter in .eleventy.js
:
eleventyConfig.addFilter("utf8_xml", (inputStr) => {
return inputStr.replace(/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm, '');
});
Then, in the feed template, add the filter to the content:
<content type="html">{{ article.templateContent | htmlToAbsoluteUrls(absoluteArticleUrl) | utf8_xml }}</content>
The solution was founded in StackOverflow
Finally going through old issues in this repo, can you provide the content that caused this issue to fail? I’d like to add some test cases.
Closing
I got this fail in the .xml, but the config is good. The same config works with other collections, but with posts fails.
This is the error: