georgemandis/jekyll-rss-feeds

feed.xml not validating

orschiro opened this issue · 7 comments

Hi there,

Thanks for your feed.xml template. I added it to my Jekyll blog which is hosted on Github.

feed.xml: https://github.com/orschiro/orschiro.github.io/blob/master/feed.xml

In my default.html layout I added the following line to link to my feed:


https://github.com/orschiro/orschiro.github.io/blob/master/_layouts/default.html

And finally I added the relevant site variables to config.yml.
https://github.com/orschiro/orschiro.github.io/blob/master/_config.yml

However, when validating my feed.xml, it did not pass the validation test:

http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Frobert.orzanna.de%2Ffeed.xml

The error is:


This feed does not validate.

line 49, column 36: XML parsing error: :49:36: not well-formed (invalid token) [help]

                <title>Prezi on Sustainability & Growth - Natural Systems</title>

I do not exactly understand the issue with the title tag here. Do you have any idea what can be wrong? Is it an encoding error?

Thanks in advance!

Robert

It's likely the ampersand in your title – &

It should be converted to an HTML entity&amp;

I don't think there are any Liquid template filters that do this automatically.

Thank you for your quick help! Now my feed appears to be valid except for (negligible) errors.

description should not contain iframe tag

No idea what to do with that one except for removing the iframe at all.

Non-html tag: figcaption

This issue in fact is weird. I thought figcaption is a valid tag when used within a <figure> tag.

My guess is that the Atom specification disallows iframe tags in the description tags and that it was written before the introduction of figcaption into the HTML5 spec, but those are just hunches.

Truthfully, if it otherwise validates and loads fine in the RSS readers & apps you're looking to use I wouldn't worry about it too much. Even the example RSS 2.0 feed nags you a bit:

http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fstatic.userland.com%2Fgems%2Fbackend%2FrssTwoExample2.xml

Even the Dave Winer's feed renders these warnings when you try to validate his feed:

http://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fs%2Fyz1rd3vgg1iw9fz%2FmyPublicProfile.xml

I'm going to close the issue now as it has more to do with working through the idiosyncrasies of the specs than the GitHub project.

Best of luck!

Thanks for your thorough explanation! So I will just take it as the validator just seems to be very picky. And indeed my rss feed is rendered correctly now. Thus no need to further bother.

To escape & to &amp; in post.title contents you can use the same xml_escape filter you're already using for site.description.

In fact, I think it's a good practice to escape all user-defined information, since special chars could also appear in site.name and site.description.

<title>{{ site.name | xml_escape }}</title>
<description>{{ site.description | xml_escape }}</description>
...
    <title>{{ post.title | xml_escape }}</title>
    <description>{{ post.content | xml_escape }}</description>

Thanks @aureliojargas! I just added this to my personal feed.xml.

But might be something what @georgemandis wants to add as well?

Cheers

Thanks for the suggestion @aureliojargas. I knew there was some filter like that can couldn't recall... should've looked more closely at my own code.

I'll push the changes through...