How to fix: Referenced AMP URL is not an AMP

只愿长相守 提交于 2019-12-04 13:05:02

Going to add an answer here as well... you could try something similar to what is described on this page which talks about mobile vs. desktop site re-directs. In particular this bit:

<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.example.com/page-1">

You have your canonical and amphtml links set-up correctly though, and the AMP Test detects the amphtml link if you run your non-AMP page through it - it's just your re-direct kills it I think. If you drop the 302 re-direct you're doing and run the AMP Test again it will probably validate.

You can probably drop the re-direct all together as Google will crawl and find the amphtml link in your header and serve that to mobile users in their search results. If you're concerned about re-directing direct visitors to your AMP version as well, then the alternate link option I linked above may be worth a shot.

It turned out that I had several issues.

First I needed to correct all the links between the AMP version and the standard version of the pages.

After that, Craig Scott was right about the redirection, it was against the Google Search guidelines for AMP to redirect the traffic that came from desktop or tablet.

However, I had another huge problem not directly related to the code on AMP.

We are using Prerender to help crawlers read the content of our page rendered with React, but it returned an invalid version of the page to the crawler of the AMP pages.

To fix this last issue I blacklisted the AMP pages (that doesn't even use custom JS!) for prerender.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!