One of the difficulties that arise when moving a site to a completely new address (as in a new DNS host name) as I’ve done, is that it is very difficult to reach out to people who visit with an RSS feed reader: either the saw the original announcement and reacted, or they didn’t. (If you are reading this, you’ve come to the right place.)

From logs and statistics I determine I’ve lost a lot of readers, little wonder: either the announcement went un-noticed or it was put on the I’ll-do-it-later list and got lost there. I’m hoping to get those readers back here, by playing a bit of a nasty trick.

Feed readers configured with the old URL for the RSS feed will see something like this when they poll for new articles:

The nasty bit is, that they’ll see that as a “new” entry every time this site’s content is generated by Jekyll.

For the time being, the old site’s feed URL is being redirected to a static XML file on the new site. This redirection is quite simple to accomplish with Apache’s mod_rewrite:

RewriteEngine On
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ [R,L]

The rss.xml file is created at every Jekyll run as follows:

layout: nil
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="">
    <title>Jan-Piet Mens</title>
    <atom:link href="" rel="self" type="application/rss+xml" />
    <description>Jan-Piet Mens</description>
    <pubDate>{{ site.time | date: "%a, %d %b %Y %H:%M:%S %Z" }}</pubDate>
    <lastBuildDate>{{ site.time | date: "%a, %d %b %Y %H:%M:%S %Z" }}</lastBuildDate>

      <title>*** Jan-Piet Mens is moving to ***</title>
      <pubDate>{{ site.time | date: "%a, %d %b %Y %H:%M:%S %Z" }}</pubDate>
      <author>Jan-Piet Mens</author>
      <guid>{{ site.time }}</guid>
      <description><![CDATA[This feed has moved. Please go to <a href=""></a> and change your feed's URL to <a href=""></a>]]></description>


Notice how I’m using site.time in the pubDate and guid elements; this inserts the system time, which is new at each Jekyll run, of course. When readers fetch the resulting RSS feed, they are tricked into thinking it’s a new post and mark it as unread.

It works. The only question is, whether I’ll get some of my faithful visitors back, or whether I’ll piss them off for good. I hope it’s the former. :-)

Site, Jekyll, RSS, Atom, and Feed :: 17 Jun 2011 :: e-mail