Ruben Laguna's blog

Aug 8, 2009 - 2 minute read - feed feedburner feedsmith feedvalidator google googlebot plugin sitemaps tags tools webmaster wordpress

Fixing "Invalid XML: too many tags" [Google webmaster tools]

I tried to use my blog feed as a sitemap in Google Webmaster Tools, but it Google complains about “Invalid XML: too many tags describing this tags” in several points in the feed.

I found in several places that this due to the format of the feed, a simple change to ATOM will fix it. But I’m using a Wordpress Feedburner plugin to redirect my blog’s feed to the Feedburner one. This plugin redirects all feeds (/wp/feed, /wp/wp-atom.php, etc.) to the feedburner feed (that for some reason Google doesn’t like).

The solution described in some blogs is to change the sitemaps address to point to the wp-atom.php directly but that won’t work in my case because the plugin redirects that too to feedburner.

So I had to update the plugin code to skip redirection if the user agent is “googlebot” (currently only skip redirections if the user agent is feedburner or feedvalidator).

That solved the issue. I changed the sitemap url in Google Webmaster Tools to point to /wp/wp-atom.php and now Google doesn’t complain about “too many tags”

If you want to do the same just edit $WORDPRESS INSTALLATION/wp-content/plugins/FeedBurner_FeedSmith_Plugin.php and look for a line containing “feedvalidator”. You should change it to look like this (it’s just adding “|googlebot” after feedvalidator):

if (!preg_match("/feedburner|feedvalidator|googlebot/i", $_SERVER['HTTP_USER_AGENT'])) {
    add_action('template_redirect', 'ol_feed_redirect');