Reputation: 23
Let's say user is navigated to one of my AMP page. And now he is clicking on some navigation item which is linking to my other page which also supports AMP. Will AMP version of that page will get open or always the normal page?
Upvotes: 1
Views: 385
Reputation: 63
The browser will follow whatever is in the href for the link. If you want the link to go to the AMP version of that page, you have to put the URL for the AMP version of that page in the href. Otherwise, it will go to the normal page.
For example, say you have this link in the page HTML:
<a href='http://www.example.com/mypage'>link</a>
If you click on this link in an AMP page, it will go to /mypage. If you want it to go to the amp version of the page, you will need to explicitly tell it to go to the amp version of the page:
<a href='http://www.example.com/mypage/amp/'>link</a>
Depends on what URL structure you use for amp pages. If you're on a CMS, you could add a filter to automatically turn any links in a page into links to the AMP equivalent.
Upvotes: 4
Reputation: 17651
From the Linking pages with guide which addresses your issue:
In order to solve this problem, we add information about the AMP page to the non-AMP page and vice versa, in the form of tags in the .
It depends on what you specified in your element.
If you open the page whose rel value in the link is amphtml
like
<link rel="amphtml" href="https://www.example.com/url/to/amp/document.html">
then it will go to the AMP version of that site.
On the other hand if you used rel value of canonical
like
<link rel="canonical" href="https://www.example.com/url/to/full/document.html">
it will go to the normal page.
Upvotes: 1