RSS lives and the topic has come up a few times recently. It got me thinking and reading stuff I haven’t looked at in a long time.
Alan’s Feed WordPress 101 is still gold and reminded me of all kinds of things I had forgotten. Back in the glory days of RSS and the Mother Blog, the hardest part was usually getting the right URL for the feed. Alan had all sorts of ways to try to help people. We built a choose your own adventure path into the old Thought Vectors process but often we’d resort to doing it manually for people.
I thought that maybe I could build something using WordPress’s REST API that might make checking the feed validity more interactive and obvious.
What you can see below is an early proof of concept.1 Anyway, I built it initially and congratulated myself. Then I realized I’d only tested it on my own site and it didn’t work on any other site. Why? CORS. CORS. CORS. I had set up my own site long ago to allow access to the API from other sites but that’s not the default state in WordPress.
A bit of Googling led me to a PHP proxy on GitHub that was made to deal with just this issue. I also had some hassle with direct PHP file access in my Reclaim Hosting directory that I tried to solve via .htaccess for some time before Tim helped me out. Turns out it’s a Apache issue and maybe some other ownership stuff.
The example below should let you put in a URL like https://bionicteaching.com/feed and it’ll show the feed content below if it’s the right URL.
If I end up with an audience/purpose, I’d make it just a plain URL that’d show the feed content. Then it’d load your category options as buttons to allow you to modify the restrictions on the feed and preview what impact those choices would have. That seems pretty nice. The downside is that it’d only work for modern-ish WordPress.
See the Pen
jquery and php proxy by Tom (@twwoodward)
on CodePen.
1 Do I do anything else? Probably not.
RSS lives and (thrives via the api). I did notice that WordPress finally includes the RSS feed URLs in meta tags for category and tag URLs.
Yes certainly finding the feed url was always the challenge. Curious what you would do with the feeds after.
And hmm I see Blogger has an API too so it could be extended there.
And then you will get a wix url and (shrug).
I really did it just because it seemed like it could possibly be interesting or useful. I was considering adding as a Gravity Forms plugin to help guide/validate RSS feed entry for FWP. Make it a field or something. No real use at the moment. Just reminiscing maybe because Jim Groom asked if he could add feeds via Gravity Forms and that led to wandering in the old posts. I knew Martha did it but the code was all gone (turns out it was straight forward anyway). I looked at your stuff and I started to remember all the old hassles.
It also let me find a made up problem and make a pretend solution which was more fun than trying to think any more about software purchasing patterns.
Hi Tom,
Interesting, my feed:
https://johnjohnston.info/blog/feed/
does nothing, checked on codepen and I get an error
TypeError: null is not an object (evaluating ‘el.querySelector(“title”).innerHTML’)
The feed validates ok on https://validator.w3.org
The problem seems to be that some items in my feed do not have a title (for micro.bog purposes).
I got the pen to work by testing to see if the title existed before getting it
Hey John – Good point. I didn’t do
muchany testing for non-standard cases like you mention but that would be the fix. I should probably check for title and for content as well. It is definitely my sloppy javascript and not your feed.