Separate URLs
In this configuration, each desktop URL has an equivalent different URL serving mobile-optimized content.

A common setup would be pages on www.example.com serving desktop users with corresponding pages served on m.example.com for mobile users.

Separate mobile URLs serve different code to desktop and mobile devices (and perhaps even tablets), and on different URLs.


TL;DR
  •     Signal the relationship between two URLs by <link> tag with rel=”canonical” and rel=”alternate” elements.
  •     Detect user-agent strings and redirect them correctly.

Annotations for desktop and mobile URLs

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

  • On the desktop page, add a special link rel=โ€alternateโ€ tag pointing to the corresponding mobile URL. This helps Googlebot discover the location of your siteโ€™s mobile pages.
  • On the mobile page, add a link rel=โ€canonicalโ€ tag pointing to the corresponding desktop URL.

We 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:

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

and 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

We 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.

Annotation in detail

Notice the attributes of the link tag on the desktop page:

  • The rel=โ€alternateโ€ attribute signals that this tag specifies an alternative URL to the desktop page.
  • The media attributeโ€™s value is a CSS media query string that specifies the media features describing when Google should use the alternative URL. In this case, weโ€™re using a media query thatโ€™s typically used to target mobile devices.
  • The href attribute specifies the location of the alternative URL, namely the page on m.example.com.

This two-way (โ€œbidirectionalโ€) annotation helps Googlebot discover your content and helps our algorithms understand the relationship between your desktop and mobile pages and treat them accordingly. When you use different URLs to serve the same content in different formats, the annotation tells Googleโ€™s algorithms that those two URLs have equivalent content and should be treated as one entity instead of two entities. If the desktop and mobile version of the page are treated as separate entities, both desktop and mobile URLs can be shown in desktop search results, and their ranking may be lower than if Google understood their relationship. Furthermore, please note some of the common mistakes in this configuration:

  • When using rel=โ€alternateโ€ and rel=โ€canonicalโ€ markup, maintain a 1-to-1 ratio between the mobile page and the corresponding desktop page. In particular, avoid annotating many desktop pages referring to a single mobile page (or vice versa).
  • Double-check your redirects โ€“ make sure that desktop pages donโ€™t inadvertently redirect to a single, unrelated mobile page.

For more information about canonical tag Click here


Leave a Reply

Your email address will not be published. Required fields are marked *