Monday, January 25, 2021

Advanced SEO - Separate URLs for Mobile and desktop applications

We can configure Separate URLs for Mobile and desktop applications

Annotations for desktop and mobile URLs

To help Google algorithms understand separate mobile URLs, we recommend using the following annotations:

  1. On the desktop page, add a rel="alternate" tag pointing to the corresponding mobile URL. This helps Googlebot discover the location of your site's mobile pages.
  2. On the mobile page, add a rel="canonical" tag pointing to the corresponding desktop URL.

google support two methods to have this annotation: in the HTML of the pages themselves and in sitemaps. For example, suppose that the desktop URL is http://example.com/page-1 and the corresponding mobile URL is http://m.example.com/page-1. The annotations in this example would be as follows.

Annotations in the HTML

On the desktop page (http://www.example.com/page-1), add the following annotation:

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

On the mobile page (http://m.example.com/page-1), the required annotation should be:

<link rel="canonical" href="http://www.example.com/page-1">

This rel="canonical" tag on the mobile URL pointing to the desktop page is required.

Annotations in sitemaps

Google support including the rel="alternate" annotation for the desktop pages in sitemaps like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
 
<url>
   
<loc>http://www.example.com/page-1/</loc>
   
<xhtml:link rel="alternate" media="only screen and (max-width: 640px)"
   
href="http://m.example.com/page-1" />
 
</url>
</urlset>

The required rel="canonical" tag on the mobile URL should still be added to the mobile page's HTML.

No comments: