How to correctly report the Desktop and Mobile URLs in the page code
Website
Author
author
Date
2020-07-16 21:00
Views
2146
Modified on: Thu, 28 Nov, 2019 at 12:47 PM
Google expressly approves separate URL configurations for desktop and mobile versions of the same website, but it recommends using specific tags to allow its algorithms to correctly interpret them:
When you add the tags, be careful that:
Let's suppose we have to add the tags that Google wants to manage 3 versions of the same website: desktop, tablet and smartphone. We need to:
Compatibility:
WebSite X5 Pro
Google expressly approves separate URL configurations for desktop and mobile versions of the same website, but it recommends using specific tags to allow its algorithms to correctly interpret them:
- Add the link rel="alternate" tag in the desktop page, for addressing the URL of corresponding mobile devices.
- Add the link rel="canonical" tag in the mobile page, for addressing the URL of the corresponding desktop.
When you add the tags, be careful that:
- you maintain a 1:1 ratio between desktop pages and corresponding mobile pages. In particular, avoid adding tags in lots of desktop pages that refer to the same mobile page (and vice versa).
- make sure redirections are implemented only between pages that are actually related to each other.
Let's suppose we have to add the tags that Google wants to manage 3 versions of the same website: desktop, tablet and smartphone. We need to:
- Open the website project for the desktop version and, in Step 1 - Website Settings > Advanced, open the Statistics, SEO and Code window and go to the Statistics, SEO and Code section.
- Now, in the Custom Code field, select the Before closing the HEAD tag option and write:
<link rel="alternate" media="only screen and (max-width: 480px)" href="http//www.mysite.com/smartphone/[CURPAGE]">Save the changes and then you can start working on the tablet version of the website:
<link rel="alternate" media="only screen and (min-width: 481px) and (max-width: 1024px)" href="http//www.mysite.com/tablet/[CURPAGE]">
- Open the website project for the tablet version and, as above, go to Step 1 - Website Settings > Advanced, open the Statistics, SEO and Code window and go to the Statistics, SEO and Code section.
- Again, in the Custom Code field, select the Before closing the HEAD tag option and this time write:
<link rel="canonical" href="http//www.mysite.com/[CURPAGE]">
- Repeat the same operations for the Smartphone and Tablet version of the website: the link tag is the same.
- When you set the tags in the Statistics, SEO and Code window, they are automatically added to the code of every page in the websites.
- When you write the tags, you must give the URL of the page you are working on as the href attribute: the [CURPAGE] string identifies the name of the page's file and this is automatically added by the program.
- You need to use the link rel="alternate" tag in the pages of the website's desktop version to declare all possible alternatives: in this case, it is repeated twice to link both the Tablet and the Smartphone versions.
- When you add the link rel="alternate" tag, you also have to declare when redirection is towards the Tablet version or the Smartphone version, rather than the desktop version. In the code of the example above, the media query strings indicate that Google must redirect to the URL of the smartphone version for resolutions less than 480px, and to the URL of the tablet version for resolutions between 481px and 1024px.
- Open the desktop version of the website. In Step 3 - Map select the page to work on and click on the Properties button.
- Open the Page Properties window, go to the Expert section and place the cursor in the Custom Code field.
- Select the Before closing the HEAD tag option and write the following tags:
<link rel="alternate" media="only screen and (max-width: 480px)" href="http//www.mysite.com/smartphone/page-1.html">where http//www.mysite.com/smartphone/page-1.html and http//www.mysite.com/tablet/page-1.html are the URLs of the Smartphone and Tablet versions that correspond to the desktop version you are working on.
<link rel="alternate" media="only screen and (min-width: 481px) and (max-width: 1024px)" href="http//www.mysite.com/tablet/page-1.html">
- Repeat this last step for all the pages on the website, so that the tags with the URLs of the corresponding Smartphone and Tablet pages are added.
<link rel="canonical" href="http//www.mysite.com/desktop/page-1.html">where http//www.mysite.com/desktop/page-1.html is the URL of the page in the desktop version of the website that corresponds to that in the smartphone or tablet version that you are working on.
Total Reply 0
Total 104
Number | Title | Author | Date | Votes | Views |
73 |
Website not working in smartphone view (6)
author
|
2020.07.16
|
Votes 0
|
Views 2089
|
author | 2020.07.16 | 0 | 2089 |
72 |
LiveChat Object. How to add a chat
author
|
2020.07.16
|
Votes 0
|
Views 2016
|
author | 2020.07.16 | 0 | 2016 |
71 |
RESPONSIVE DESIGN TROUBLES (2)
author
|
2020.07.16
|
Votes 0
|
Views 2216
|
author | 2020.07.16 | 0 | 2216 |
70 |
How to check the correct functioning of a responsive Website using the local Preview
author
|
2020.07.16
|
Votes 0
|
Views 2044
|
author | 2020.07.16 | 0 | 2044 |
69 |
How to change Header and Footer
author
|
2020.07.16
|
Votes 0
|
Views 2027
|
author | 2020.07.16 | 0 | 2027 |
68 |
How to manage the contents of a responsive website
author
|
2020.07.16
|
Votes 0
|
Views 2202
|
author | 2020.07.16 | 0 | 2202 |
67 |
How to set up a redirection according to the device resolution
author
|
2020.07.16
|
Votes 0
|
Views 2019
|
author | 2020.07.16 | 0 | 2019 |
66 |
How to correctly report the Desktop and Mobile URLs in the page code
author
|
2020.07.16
|
Votes 0
|
Views 2146
|
author | 2020.07.16 | 0 | 2146 |
65 |
How to create the Desktop and Mobile versions of a website
author
|
2020.07.16
|
Votes 0
|
Views 2004
|
author | 2020.07.16 | 0 | 2004 |
64 |
How to create a Responsive Website
author
|
2020.07.16
|
Votes 0
|
Views 2016
|
author | 2020.07.16 | 0 | 2016 |