Open irosyadi opened 1 year ago
Interesting. I can't help other than confirm I see this issue too. I haven't dug any deeper other than verifying my garden's feed at https://hive.mod0.org/feed.xml has same error. I've not used/looked at that before and so not a big deal for me yet but is a feature I would like working for some future integrations.
Uninformed thought/no research: I wonder if the difference between working/non-working feeds is triggered by a specific post title/comment that has special characters in it that need to be escaped before being tossed to the generator of the feed.
I looked more closely. In the working RSS, the 'feed.xml' file correctly closes the 'link' tag.
<link href="https://dg-docs.ole.dev/feed.xml" rel="self" />
<link href="https://dg-docs.ole.dev" />
<link href="https://dg-docs.ole.dev/troubleshooting/" />
But, in the faulty RSS, the 'link' tag isn't closed properly.
<link href="https://notes.ole.dev/feed.xml" rel="self" >
<link href="https://notes.ole.dev" >
<link href="https://notes.ole.dev/ressurser/snippets/vim-cheatsheet/" >
Interesting. Looping back to learn more about this by playing around and documenting my thought process in case it helps others debug this.
In the the feed.njk template it has four //// for the links like so: https://github.com/oleeskild/digitalgarden/blob/main/src/site/feed.njk#L10
<link href="{{ meta.siteBaseUrl }}{{ permalink }}" rel="self" ////>`
The reason behind using four ////
in that tag escaping me. Looking at 11ty's RSS example they have the standard syntax I'd expect of a single / like so:
<link href="{{ metadata.url }}"/>
However, we don't have a feed.xml
file we have a feed.njk
file, and the .njk
means this is a Nunjucks template file. In theory the way to get a trailing /
for the tag should just be as simple as putting it directly there in the file and there isn't a need for ////
.
I did a few quick tests directly on my site to see if removing the extra /// solved the feed issue. (Running with scissors in my own garden is fun).
When switching to a single / I ended up with none rendered in the final feed.xml. I tried doing //
to see if that changed things and still nope. Even tried \/
and ended up with just a \
which just caused XML syntax errors.
////>
becomes >
///>
becomes >
//>
becomes >
/>
becomes >
\/>
becomes \>
an XML syntax error/ >
becomes / >
another XML syntax error: XML Parsing Error: not well-formed\\/>
becomes '\>` another XML error></link>
becomes >
- hey, what is going on there? somebody is "helping" and I bet that somebody is the culprit for the confusion above./////>
becomes />
- *HEY THAT IS WHAT WE WANT -- Is FIVE the magic? Not 1, 2, 3, 4 but 5?"So yeah, apparently the fix in feed.njk
is to for each link tag to have five /////
like so:
<link href="{{ meta.siteBaseUrl }}{{ permalink }}" rel="self" /////>
<link href="{{ meta.siteBaseUrl }}" /////>
I just applied the fix suggested by @dayne. The /feed.xml from my digital garden is not throwing errors anymore. There were three lines on the feed.njk file where I added an extra /
: 10, 11, and 26.
Hi, it seems that the error is still present. example, this test site that I'm using https://functionalitytest.vercel.app/feed.xml
Hi, it seems that the error is still present. example, this test site that I'm using https://functionalitytest.vercel.app/feed.xml
Eventually, rss works fine by applying the previously mentioned fix
There was a problem with the Atom/RSS feed at /feed.xml. The error message says
error on line xx at column 17: Opening and ending tag mismatch: link line xx-1 and entry
. The specific linexx
with the error can vary from site to site.I found similar errors in these feeds: https://notes.ole.dev/feed.xml and https://hermitage.utsob.me/feed.xml. But these feeds are fine: https://dg-docs.ole.dev/feed.xml and https://notes.johnmavrick.com/feed.xml.