dylang / node-rss

RSS feed generator for Node.
https://npmjs.org/package/rss
MIT License
1k stars 133 forks source link

Documented example for 'categories' doesn't validate according to W3C #57

Closed mikemaccana closed 8 years ago

mikemaccana commented 8 years ago

Per README.md

categories optional array of strings One or more categories this feed belongs to.

I'm using:

 categories: ['Technology', 'Information Security', 'Software Development'],

Which returns the following at the W3C validator:

XML parsing error: <unknown>:1:1192: unbound prefix
ategory><![CDATA[Software Development]]></category>
ErisDS commented 8 years ago

Hi @mikemaccana :)

We're using pretty much the exact same thing in the Ghost source see here, and aren't seeing any errors with validation.

Do you have an extended example, RSS snippet, or URL I could take a look at?

mikemaccana commented 8 years ago

Sample URL: https://certsimple.com/blog/rss.xml

Suspect the cause of the error is namespace prefix 'webfeeds' is totally missing. I.e.:

 xmlns:webfeeds="http://webfeeds.org/rss/1.0"

should exist on the element on the generated output but isn't.

mikemaccana commented 8 years ago

OK so I just needed:

custom_namespaces: {
    webfeeds: "http://webfeeds.org/rss/1.0"
}
mikemaccana commented 8 years ago

To give some context, looks like the W3C validator was failing on:

 <webfeeds:logo>http://certsimple.com/images/blog/logo.svg</webfeeds:logo>

Not on the categories tag - the validator was a few characters off.

mikemaccana commented 8 years ago

PS. Thanks! 😀