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

XSL for presentation of Atom feeds #26

Open
nhoizey opened this issue Apr 29, 2021 · 4 comments
Open

XSL for presentation of Atom feeds #26

nhoizey opened this issue Apr 29, 2021 · 4 comments

Comments

@nhoizey
Copy link

nhoizey commented Apr 29, 2021

I tried to use pretty-feed-v3.xsl for my Atom feeds, but it didn't work at all because Atom and RSS have different XML structures.

I tried to build an alternative version for Atom feeds, but I don't know if my specific Atom feeds match the common use case.

I also don't know if it would be possible to share a single XSL stylesheet for both RSS and Atom.

Here's my version:
https://github.com/nhoizey/nicolas-hoizey.com/blob/main/src/assets/pretty-atom-feed-v3.xsl

Here's how it looks:
https://nicolas-hoizey.com/feeds/all.xml

A few notes:

  • I removed the target="_blank" attributes for accessibility
  • I moved the code for each item in a specific <xsl:template> to ease maintenance

I can make a PR if you want to iterate over it.

@nhoizey
Copy link
Author

nhoizey commented Jan 29, 2022

I just made a much lighter version without all CSS rules that were not used and using simple CSS instead of a bunch of utility classes:
nhoizey/nicolas-hoizey.com@ac2ad20

Would you find it useful here?

@jaygooby
Copy link

Works nicely for my Jekyll generated atom feed at https://jay.gooby.org/feed.xml

@cimm
Copy link

cimm commented Apr 29, 2022

I was about to write my own when I found this issue. It works flawlessly for my Atom feed, thank you @nhoizey! Would it be possible to merge your Atom XSL with this repository? Maybe we could have a pretty-feed-v3-rss.xsl and pretty-feed-v3-atom.xsl version here? This prevent newbies like myself to try to apply the RSS version to an Atom feed?

@Dan-Q
Copy link

Dan-Q commented Jul 28, 2023

Just stumbled upon this issue randomly: I recently made an XSL that works for both RSS and Atom: https://gist.github.com/Dan-Q/149579c66c938b566c45beefcf5914a4

The trick is to have a <xsl:for-each select="/rss/channel/item"> and a <xsl:for-each select="/atom:feed/atom:entry"> - the former iterates through the posts if it's an RSS feed, the latter if it's an Atom feed.

It's probably reasonably feasible to do similar things with the title etc.

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

4 participants