jekyll / jekyll-feed

:memo: A Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts
MIT License
827 stars 201 forks source link

Use Content-Type: application/atom+xml #358

Closed gsnoff closed 2 years ago

gsnoff commented 2 years ago

Currently the feed generated by this plugin is served with Content-Type: application/xml. Some browsers (Firefox on Debian?) tend to treat such content as arbitrary XML, e.g. showing its internal tree, instead of pretty-printing it with a subscribe option, regardless of whether the content itself is valid Atom content with xmlns set and whatnot.

When the HTTP header is Content-Type: application/atom+xml, the said browsers behave as expected.

parkr commented 2 years ago

We use mime-db to generate our mime.types file for Jekyll (and GitHub Pages uses the same). It looks like application/atom+xml requires the .atom extension.

You can set this with your feed configuration:

# in config.yml
feed:
  path: /feed.atom
parkr commented 2 years ago

Unfortunately changing the path globally would cause issues. We could potentially write both paths from now on when config.feed.path is unset and set the rel=alternate to the new .atom path. We can't do 301 redirects (which feed readers generally follow) since GitHub Pages doesn't support redirects. The best bet would be to drop /feed.xml in a major version bump and loudly communicate that this path was being moved. Not sure it's feasible for the benefits here when folks can set config.feed.path to get this functionality today.

parkr commented 2 years ago

Sent a PR to update the docs examples to use .atom for customizing the feed path: https://github.com/jekyll/jekyll-feed/pull/359