[Looking for Charlie's main web site?]

Bloggers: validate your feed on new entries, or you and your readers could suffer. Here's how

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Have you ever found (as a blogger or as a reader of a blog's feed) that sometimes it seems the feed just seems to stop working? It could be that it's become invalid. Here's a tip.

Bloggers: you really should validate your feed on every new submission. You never know when some special character you used (or copy/pasted from elsewhere) might make your feed invalid.

In this entry, I propose a couple of possible solutions, either that you may find or that you can easily add to your own blog.

Validating your feed. Does your blogging tool do it?

I imagine some blogging tools may even offer this as a feature. It's easy enough to validate one's feed with a tool like http://feedvalidator.org/. You can easily validate your own by adding your URL with http://feedvalidator.org/check.cgi?url=yoururl. (Technically, the value of yoururl should be URLEncoded.)

Validating it yourself on each new entry

If your blogging tool doesn't do that validation for you, here's another thought: you could easily do it yourself. Here's code I use to check the feed whenever a new entry is made. It looks at the validation result and sends me an email if it fails, which has saved my bacon a couple of times:

<cfhttp url="http://feedvalidator.org/check.cgi?url=#urlencodedformat("http://carehart.org/blog/client/rss.cfm?mode=full")#" resolveurl="Yes">

<div id="content">

<cfif cfhttp.filecontent does not contain "congratulations">
   <cfmail to="myemailaddress" from="myemailaddress" subject="Your Blog's RSS feed has failed" type="HTML">
      <p><a href="http://feedvalidator.org/check.cgi?url=#urlencodedformat("http://carehart.org/blog/client/rss.cfm?mode=full")#">http://feedvalidator.org/check.cgi?url=#urlencodedformat("http://carehart.org/blog/client/rss.cfm?mode=full")#</a></p>
#cfhttp.filecontent#
   </cfmail>
   <cfoutput>
      <h4>Validation Failed</h4>
      For http://carehart.org/blog/client/rss.cfm?mode=full. Email sent to myemailaddress.
      <p><a href="http://feedvalidator.org/check.cgi?url=#urlencodedformat("http://carehart.org/blog/client/rss.cfm?mode=full")#">http://feedvalidator.org/check.cgi?url=#urlencodedformat("http://carehart.org/blog/client/rss.cfm?mode=full")#</a></p>
   </cfoutput>
<cfelse>
   <cfoutput>
      <h4>Validation passed.</h4>
      For http://carehart.org/blog/client/rss.cfm?mode=full passed.
   </cfoutput>
</cfif>
</div>

Of course, you could just drop that code into your blogging code if you're comfortable doing that.

Using your blog tool's Ping feature

But if you don't want to edit your blogging code, you could do this just as easily with your blogging tool's ping feature, if it offers one. These are more typically used to provide one or more URLs which the blogging tool will call when you offer a new entry, such as to notify blog aggregators of your new entry (rather than waiting for them to come back to find your entry eventually).

You could use that same feature have it go to a URL on your own site that runs the code above. That's what I do.

Is there a service doing this already?

I suppose someone could set up a service to do this, letting you pass in the URL and email addresses. For now, I'm not in a position to do that on my own server for others. One would need to be careful not to let this be abused in any way. I also imagine it could get used by a lot of folks.

I kind of wonder why some free service hasn't yet been created to do this. Surely someone could find a way to monetize it. :-)

Anyone know of such a tool?

Anyway, there's the idea and the code above, if it may help.

PS: This is more than just for bloggers

BTW, this applies to more than just blogs. Anything where you add items that offer an RSS feed to read them, this would make sense, such as podcasts, news items, and more.

In fact, I've been meaning to write this entry for a long time, and was actually motivated when I came across some failing OPML for one of the CF blog aggregators today. I dropped a note to the owner, letting him know that someone had slipped in a bad character when they'd entered a new feed to him. I suggested he could benefit from this idea (as would others), and that I'd blog about it. There you have it.

For more content like this from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Charlie: I'd argue that a blogging app should be filtering out problematic content before it ever reaches the feed, rather than flagging issues after-the-fact.

That aside, Feedburner's services include something in your ballpark. I think it's called FeedBulletin or something... let's you know when it detects a problem on your end.
I always subscribe to my feeds, both RSS and e-mail. It's hard to miss a verklempt feed then.

I don't know why more bloggers don't to that.
# Posted By Al Everett | 4/17/08 12:47 PM
@Roger: that's a fair point, but again, some people don't have access to the code that runs their blog (if it's a hosted service), or they don't want to muck with the code (if it's on their own server). So I was making the point first to make them aware, then to offer a solution if they couldn't/wouldn't update their code. But yes, you could argue that the blog makers or individuals who control their blog code could do the prevention up front.

That said, regarding the feedburner feature you mention, it's discussed at http://www.google.co... I notice that they say "So how do I keep that junk from coming into my feed/blog? Our best advice is to compose your postings in a straight text editor."

So they recognize that some people don't have control over their blogging tool letting them enter bad data. They make a good point, so I offer it here. But many of us use plain text editors (my version of BlogCFC offers just a textarea), and yet STILL some bad stuff gets in.

And to be fair, it may be that later versions of BlogCFC do eitehr better filter bad text or may even do the feed validation.

Again, I was speaking to a broad audience that might be on many different blogging tools. Hopefully it will help some.

@Al, you make a fair point, too, but I guess my concern is whether you'd think that those steps would notify you when the feed is bad. As I alluded to in my first sentence, my experience is that feed readers and email programs simply stop sending you new entries if the feed is bad. Of course, it could depend on the tool. If they did not offer an error, then relying on that would seem to give a false sense of security. :-) What do you think?
Hi Charlie,

Thanks for the article it's really helpful for new bee like me in the blogging world.
# Posted By Akbar | 4/19/08 1:52 AM
Glad to help, Akbar. Thanks for the feedback.
Charlie,
Thanks so much for the code. I'm more of a general blogger, and I guess I never paid much attention to this issue. I'm going to customize and keep your code in my library for inclusion on all my posts from this point on. Thanks.

Daryl
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting