How to add hreflang tags to all my wordpress AMP pages?

I’ve implemented Mobile optimized plugins to make our WordPress generate AMP versions of all the posts in the wordpress database. I’ve got them all correctly printing rel=canonical and rel=amphtml appropriately.

The standard non-amp pages have the correct hreflang tags also.

I’ve searched in vein for a WordPress Plugin that will do this for me but can’t locate one that does the job. We are not using WPML on our wordpress but occasionally have alternate language blog posts on a parallel wordpress install.

What I want to do is just print the correct hreflang for the vast majority of blog posts ~200 into the AMP head.

Is there a means for me to use some script to inject the URL (minus any URL parameters) into the head of the AMP versions?

Read more here: How to add hreflang tags to all my wordpress AMP pages?

Leave a Reply

Your email address will not be published. Required fields are marked *