hugo: RSS feeds do not validate
The RSS 2.0 feeds generated by Hugo do not validate. For example, look at feedvalidator.org’s report on the spf13.com blog.
Sorry
This feed does not validate.
line 9, column 4: Undefined channel element: author [help]
<author>Steve Francia</author>
^
line 18, column 27: Invalid email address: Steve Francia (15 occurrences) [help]
<author>Steve Francia</author>
^
line 165, column 44: pubDate must be an RFC-822 date-time: Tue, 01 Jul 2014 00:00:00 UTC (13 occurrences) [help]
<pubDate>Tue, 01 Jul 2014 00:00:00 UTC</pubDate>
^
In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
Your feed appears to be encoded as "utf-8", but your server is reporting "US-ASCII" [help]
line 110, column 0: description should not contain relative URL references: /templates/list (14 occurrences) [help]
</description>
line 1619, column 0: Non-html tag: figcaption (4 occurrences) [help]
<img src="/media/pingdom-old.png" alt="Pingdom of for ...
I spent several years working on a feed reader at Apple, and malformed feeds were the bane of my existence. It’s not hard to check that you’re generating a valid feed; please do so, for the sake of the feed readers!
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (11 by maintainers)
Commits related to this issue
- Trivial fixes to get RSS 2.0 feeds to validate. RSS 2.0 requires the email be listed in `<author>`, and `UTC` as a timezone is not accepted, but `UT` or `GMT` are. See #789 for more information. Th... — committed to gohugoio/hugo by anthonyfok 9 years ago
- Make RSS dates valid See #789 — committed to gohugoio/hugo by bep 9 years ago
- Fix 0.14 syntax in 0.13 docs See #789 — committed to gohugoio/hugo by bep 9 years ago
- Trivial fixes to get RSS 2.0 feeds to validate. RSS 2.0 requires the email be listed in `<author>`, and `UTC` as a timezone is not accepted, but `UT` or `GMT` are. See #789 for more information. Th... — committed to tychoish/hugo by anthonyfok 9 years ago
- Make RSS dates valid See #789 — committed to tychoish/hugo by bep 9 years ago
Thank you for reporting this issue, @snej.
For those who are interested, here is what I have learned thus far. According to the RSS 2.0 Specification:
<channel>
does not have an<author>
element, but<managingEditor>
and<webMaster>
are available.<managingEditor>
,<webMaster>
and<author>
all expect an email address followed by an optional full name in parentheses, e.g.geo@herald.com (George Matesky)
<pubDate>
etc. must strictly adhere to RFC-822 Date and Time Specification, which acceptsUT
,GMT
orZ
as valid and equivalent timezones, but notUTC
.{{ .Date.Format "MST" }}
would generateUTC
when no time is given indate
in the front matter, e.g.date = "2015-01-12"
. Nowadays, however,hugo new post/test.md
would automatically put in the current date/time with timezone, e.g.date = "2015-01-12T14:33:38-07:00"
, so most users won’t see this bug. However, withTZ=GMT hugo new post/test.md
, the resulting timestamp would bedate = "2015-01-12T14:33:38Z"
, which becomesUTC
in the feed XML file.I have modified the rss.xml template in
hugo/tpl/template_embedded.go
accordingly, committed as 700c2b8. Now, the W3 Feed Validation now comes out clean for the RSS feed on my simplistic personal website.However, the other errors aren’t as trivial:
It would seems that to get feeds of pages with extras like
<iframe>
and<script>
to validate, tags like these will need to be filtered out, and all relative URL references will need to be converted to full URLs, a kind of sanitization run, so to speak.I am too new to Go and to the Hugo team to tackle that. Should something like this (probably an enhancement rather than a bugfix) be added to Hugo? Please discuss. 😃