Preparing your WordPress blog for Google’s podcast search
I heard on Libsyn’s The Feed episode 119 that Google will start scraping podcast feeds to use in their services.
Rob and Elsie recommended that you have a tag like this on the home page of your podcast:
<link rel="alternate" type="application/rss+xml" title="YOUR PODCAST NAME" href="https://yourfeedurl.libsyn.com/rss" />
WANT TO WRITE A BOOK?
Download your FREE copy of How to Write a Book »
(for a limited time)
The tricky thing is you should have no other RSS feeds on your podcast’s home page. My podcast’s home page is simply a category page on my blog. I have a bunch of other feed tags on that page. If your podcast is set up this way, hopefully you’ll find this helpful.
Here’s what I did to get rid of those feed tags, and to put the proper tag on my category home, without messing up any of my other pages.
Note that I’m not the world’s best developer, so I’m probably not doing this the best way. This is just what I was able to piece together from disparate help articles. This article assumes you have some knowledge, so you can customize this code according to your own setup.
First I went into my theme’s functions.php
, and inserted this code:
function google_podcast_rss($query) {
if ($query->is_category('Love Your Work Podcast')) { // Checks for the category that is your podcast home. Change out the name of your category.
remove_action('wp_head', 'feed_links_extra', 3); // Removes any "extra" feed links, such as the comments feed.
remove_action('wp_head', 'feed_links', 2); // Removes RSS feed links
}
return $query;
}
add_filter('pre_get_posts', 'google_podcast_rss');
Then, I went into my theme’s header.php
, and inserted this code:
<?php if (is_category('Love Your Work Podcast')) { //if it's the podcast home, include the podcast RSS feed for Google. Don't include the others because it confuses Google ?>
<link rel="alternate" type="application/rss+xml" title="Love Your Work Podcast" href="https://kadavy.libsyn.com/rss" // Inserting my RSS feed if the category name matches />
<?php } else { // This is how I insert RSS & other links into my header on all other pages. Note this is probably not ideal – it's just legacy code in my theme. ?>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/rdf+xml" title="<?php bloginfo('name'); ?> RDF Feed" href="<?php bloginfo('rdf_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<?php } ?>
Now the Love Your Work home page has a link to my Libsyn RSS, and no other feeds. Presumably, Google will not get confused. It remains to be seen if Google will pick it up – I’ll be checking with Google Assistant for iOS (as described on episode 120) in a couple of days.