Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logo element should not go at end of Atom feed from yesod-newsfeed #1743

Open
cdepillabout opened this issue Dec 25, 2021 · 1 comment
Open

Comments

@cdepillabout
Copy link

cdepillabout commented Dec 25, 2021

It appears that Atom feeds produced by yesod-newsfeed don't validate the w3 validator: https://validator.w3.org/feed/check.cgi

In particular, my personal website is using yesod-newsfeed, and it has the following errors: https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Ffunctor.tokyo%2Fblog%2Ffeed

image

This appears to be caused by Yesod.AtomFeed.template putting the logo at the end of the feed, instead of near the top:

root = Element "feed" Map.empty $ map NodeElement
$ Element "title" Map.empty [NodeContent feedTitle]
: Element "link" (Map.fromList [("rel", "self"), ("href", render feedLinkSelf)]) []
: Element "link" (Map.singleton "href" $ render feedLinkHome) []
: Element "updated" Map.empty [NodeContent $ formatW3 feedUpdated]
: Element "id" Map.empty [NodeContent $ render feedLinkHome]
: Element "author" Map.empty [NodeElement $ Element "name" Map.empty [NodeContent feedAuthor]]
: map (flip entryTemplate render) feedEntries
++
case feedLogo of
Nothing -> []
Just (route, _) -> [Element "logo" Map.empty [NodeContent $ render route]]

I tried to read through the Atom specification to find where it was specified that logo must come before any entries, but I couldn't actually find anything saying this: https://datatracker.ietf.org/doc/html/rfc4287. So it is also entirely possible that the w3 validator is incorrect here, and it is okay to have logo at the end of a feed.

All things considered, I think this is a very benign bug (if a bug at all).

@schoettl
Copy link
Contributor

I think it wouldn't hurt to move the logo up and put it before the feedEntries... and the validator would be happy ;)

But I also don't know why the implementers of the validator think that this matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants