Mirroring Atom feed to a different URL to support legacy clients

I am in the process of migrating a Pelican site to Zola. By convention, the main RSS feed generated by Pelican has the URL example.com/feeds/all.atom.xml. With my Zola configuration, the feed lives at example.com/feed.xml instead:

generate_feeds = true
feed_filenames = ["atom.xml"]

Is it possible to configure my site build so that the contents of /atom.xml will be copied directly to /feeds/all.atom.xml so that readers don’t have to reconfigure their RSS readers?

I updated the <link rel="alternate" ... /> element in <head>, but I noticed that at least one RSS reader (FreshRSS) stores the feed URL as a separate database entry, suggesting that it won’t actually recheck this and will keep trying to pull from the original URL.

I tried putting an HTML redirect as a static page /feeds/all.atom.xml but browsers won’t follow the redirect/parse it as HTML.

No, but I see 3 workarounds:

  • If your web server is configured to follow symbolic links and you are on linux, create a symbolic link in static/ that will thus be copied to public/ on deployment
    `cd static/feeds; ln -s ../../public/atom.xml all.atom.xml`
  • Redirect via your web server itself (best solution). E.g. for apache, either in the main config or a .htacess file:
    Redirect permanent /feeds/all.atom.xml /atom.xml
  • If you build your zola with a script or command, just copy the file in your script after the zola build.
1 Like

It’s a github pages site, so unfortunately no control over the server. Looks like a wrapper script for the build process is indeed the way to go. Thank you!