This post is filed under “I had an obvious need, I searched for it and found nothing, so here comes a blog post for the next searcher.” If you don’t do local web development or don’t know what that means, please watch this video instead, I promise it’s worth your three minutes and sex seconds.
TL;DR: You can preview local RSS feeds on OSX using ViennaRSS, a simple free app.
The problem: Previewing RSS output from a local development site
Developing locally: I run MAMP as my local server on my Mac to work on WordPress sites. As most developers know, this makes it easy to quickly edit the many PHP/HTML/CSS/JS scripts that make up the site using whatever tools I want, and importantly avoids my edits affecting the production server where my actual sites live. It’s easy to view local sites in any browser using generic URLs like https://localhost/ (most cases) or custom ones like https://dev.gv (which I set up for developing Global Voices).
Modern RSS services can’t fetch local URLs: What’s not easy is previewing the experience of reading your RSS feed, because the way most RSS services work these days makes it impossible. Generally speaking RSS readers function based on services which fetch the RSS for you, then serve you the results. These services can’t see your local feeds because their servers have no way of accessing your localhost (nor would you want them to).
Why do I want to preview RSS? Whenever I add special formatting into the posts we use on Global Voices (things like expandable boxes, translation quotes, pull-quotes, user lists) I try to ensure that they look good in RSS as well as the homepage, which is not easy considering you lose access to all the JS and CSS the special content normally relies on. This can be a very tricky process, and being able to see the output rendered normally is really valuable (in addition to looking at the raw XML/RSS in Chrome which just shows you the code).
Old fashioned RSS was better at this: In the past RSS readers were much less efficient but also way more simple: You gave them a URL of an RSS feed and they fetched the content. The irony is that in improving the efficiency, reliability and performance of RSS, these newer services accidentally killed our ability to test and preview the content we’re putting out.
My Solution: Use “ViennaRSS” for OSX to Subscribe to your Feed
There is nothing amazing or revolutionary about this solution, I just wanted to share the outcome of my search. After a few wrong turns and failed attempts, I found ViennaRSS, a straightforward, old-fashioned RSS reader that has been updated enough to work on modern OSX.
In Vienna I was able to add a new feed, give it my local URL (https://dev.gv/feed/) and view the posts to see how they looked.
It doesn’t have any inspect/dev tools to speak of, so don’t expect it to solve all your development problems (view the raw RSS in Chrome to see the HTML), but you can see what most users are likely to see and avoid any major blunders with your new code before it has any effect on your actual RSS readers.
Tips and Troubleshooting
- Remember to disable any caching on your local site, as it will likely serve out-of-date versions of your RSS to Vienna.
- You can refresh your feed (after making changes to your PHP) by right-clicking your feed in the Vienna sidebar and choosing “Refresh”.
- “Mark updated articles as new” is an option in Vienna’s Preferences menu that seems to help it refresh more effectively. If the “Refresh” tool doesn’t update the post with your changes, try enabling this setting first.
- Another way to “force” the refresh of a post is to re-save it in your CMS. I found that Vienna will keep showing me the same version of a WordPress post regardless of refreshing, but re-saving the post, then refreshing Vienna showed me an up-to-date version of my RSS output.
Don’t forget to validate!
The W3 Feed Validator is an extremely useful tool for debugging production RSS issues (by giving it your feed URL), but it can also debug local feeds! By using the Validate by Direct Input button you can copy your feed’s entire XML code from Chrome and paste it in.
It’s easy to break the “validity” of your RSS when you add things to it, so using the W3 validator is really valuable both for making sure your code is right and to debug any problems you might be having with Vienna or any other RSS reader that can’t handle your RSS.