Amp-wp: Hook for remove AMP Stories feed from Header

Created on 5 Sep 2019  路  4Comments  路  Source: ampproject/amp-wp

When you add a Google Podcast feed to the head of your site, no other feeds can be added to the header. Google says:

The homepage cannot have another <link type="application/rss+xml" rel="alternate"> element on it. The homepage must be available to Googlebot at the exact URL specified in the RSS feed. The homepage must have the following HTML element somewhere in the page code:

See the Google documentation: https://developers.google.com/search/reference/podcast/homepage-requirements

AmpStories feed was added on #2641.

There are some hook to remove the feed from header?

AMP Stories (obsolete) Support

Most helpful comment

Humm. This seems like a bug on the Google Podcasts side of things. It is very common for a site to have multiple rel=alternate side of things. For example, on https://blog.amp.dev/ there is:

<link rel="alternate" type="application/rss+xml" title="The AMP Blog 禄 Feed" href="https://blog.amp.dev/feed/">
<link rel="alternate" type="application/rss+xml" title="The AMP Blog 禄 Comments Feed" href="https://blog.amp.dev/comments/feed/">

Almost every WordPress site is like this.

I'll see if I can find out who to reach out to on the Google Podcasts team to address this.

Update: b/140577368

All 4 comments

Humm. This seems like a bug on the Google Podcasts side of things. It is very common for a site to have multiple rel=alternate side of things. For example, on https://blog.amp.dev/ there is:

<link rel="alternate" type="application/rss+xml" title="The AMP Blog 禄 Feed" href="https://blog.amp.dev/feed/">
<link rel="alternate" type="application/rss+xml" title="The AMP Blog 禄 Comments Feed" href="https://blog.amp.dev/comments/feed/">

Almost every WordPress site is like this.

I'll see if I can find out who to reach out to on the Google Podcasts team to address this.

Update: b/140577368

something like:
remove_action( 'wp_head', 'print_feed_link', 3 );

since the feed is added here.

Sure, this will do that:

add_action( 'init', function() {
    remove_action( 'wp_head', [ 'AMP_Story_Post_Type', 'print_feed_link' ] );
} );

However, this should only be needed temporarily to fix the symptom. I believe the underlying problem should be fixed on the Google Podcasts side of things and then this workaround can be removed.

thanks @westonruter ... tested and works!

Was this page helpful?
0 / 5 - 0 ratings