WordPress, Feedburner and sitemaps

UPDATE (19/03/2011): it seems the last version of the plugin already takes care of Googlebot, so this post has to be considered outdated.

If you use Feedburner for your wordpress feed, you probably use the FD Feedburner plugin for WordPress . The plugin is cool because it redirects your users to your Feedburner while letting Feedburner itself accessing your wordpress feed; and it’s really simple to configure.

But if you want to submit your feed to Google Webmaster Tools, Google will be redirected to your Feedburner too. While you may expect it to work, in some case it won’t. If you track clicks on Feedburner in fact, your feed will have changed links in it. Feedburner changes the <link>URL</link> to an internal URL that will redirect to your own URL after tracking stuff.

As a consequence, if you submit your feed as a sitemap on Google Webmaster Tools, Google will show you errors like this:

Feedburner and Google sitemap

This happens because the URLs in the Feedburner feed are not into your own domain but on http://feedproxy.google.com/

To fix this behaviour, easiest solution is having Google accessing your original feed (http://yourblog.tld/feed/) instead of being redirect to Feedburner. This can be easily done with a little change in the plugin.

Edit your plugin (with a text editor accessing the file via ftp, or just from the dashboard -> Plugins -> Editor, and select the FD Feedburner plugin) and look for this piece of code:

function feedburner_redirect() {
global $feed, $withcomments, $wp, $wpdb, $wp_version, $wp_db_version;

// Do nothing if not a feed
if (!is_feed()) return;

// Do nothing if feedburner is the user-agent
if (preg_match(‘/feedburner/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

// Do nothing if not configured
$options = get_option(‘fd_feedburner’);
if (!isset($options[‘feedburner_url’])) $options[‘feedburner_url’] = null;

Just change the line

if (preg_match(‘/feedburner/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

with:

if (preg_match(‘/(feedburner|google)/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

and you are done. Google won’t be redirected to your Feedburner feed, and it will use your original feed as sitemap.

Comments

  1. By any chance, do you know how you would make the same change within FeedWordPress? I’m having the same problem with my sitemap.xml file but am using FeedWordPress instead of the FD Feedburner plugin.

  2. hi Erik and sorry for delay.

    no idea, but try to look at the code of the plugin and see if there’s a reference to feedburner as user-agent. if so, add google to the list and it should be ok.

Speak Your Mind

*