Question

I am using Pelican 3.2 to generate a blog with RSS feeds. However, running the RSS feed through W3C's feed validator raises the following errors:

guid must be a full URL, unless isPermaLink attribute is false

One of the offending lines is

<guid>tag:foo,2013-08-07:bar.html</guid>

It appears that Pelican uses feedgenerator, but I couldn't find any relevant configuration options.

How should I fix this?

Was it helpful?

Solution

I believe the solution is to modify feedgenerator, changing:

handler.addQuickElement("guid", item['unique_id'])

...to:

handler.addQuickElement('guid isPermaLink="false"', item['unique_id'])

RSS already has a link attribute; feedgenerator currently assumes the unique_id is a URL and should not do so. I suspect this is the best way to address the problem.

OTHER TIPS

I think Justin Mayer's answer is trying to do the right thing, but isn't quite right. At least, using Pelican 3.6.3 and feedgenerator 1.7, that fix produces non-well-formed XML:

<guid isPermaLink="false"> ... </guid isPermaLink="false">

Instead, I changed the same line

handler.addQuickElement("guid", item['unique_id'])

(at line 283 of feedgenerator.py, in version 1.7) to:

handler.addQuickElement('guid', item['unique_id'],
                        attrs={"isPermaLink": "false"})

This turned the invalid RSS that Pelican was generating for me into RSS that validates correctly at http://validator.w3.org/feed/check.cgi.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top