0

I'm using WordPress on my website. To add the AMP pages to my website I use the official WordPress AMP plugin and another plugin called "AMP for WP". I've been using it for 3 months now. Recently, I discovered a Non-AMP page while searching Google from Laptop (Not mobile device). I checked the page source and found that the rel-canonical tag is properly set to the non-AMP page. I don't know why it appeared in the desktop search.

To see the example google this "how to change Author box gravatar size" and you'll find the AMP page and the non-AMP page doesn't appear.

Where is the problem?!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Elgameel
  • 43
  • 9

1 Answers1

0

It most likely was designed outside of the Wordpress environment.

We design our AMP pages outside of the Wordpress environment and the canonical tag is just like a normal page.

In short, our amp pages self contained and are desktop & cell phone ready.

Only one canonical tag is needed then. (no use of the rel-canonical tag)

$strCanonicalUrl ="https://" . $_SERVER['HTTP_HOST'] . parse_url( 
$_SERVER['REQUEST_URI'], PHP_URL_PATH );

...

<title >This is the title of the AMP page</title>
<meta name="description" content="This is the description of the AMP page">
<link rel="canonical" href="<?= $strCanonicalUrl ?>" />
<meta property="og:locale" content="en_US" />