johntabita — 2013-01-03T15:49:33-05:00 — #1
We've just began developing some mobile sites. It seems that at least one customer's mobile site appears in the desktop search results for his keyword phrase and location. In fact, the m.domain.com shows up just above his desktop URL in the Google SERP.
These are not separate sites. We have a redirect code in place to direct mobile users to the mobile version of the site. I've never seen a m.domain in a desktop search ... until now.
Is there some additional code I should be using to prevent this? Perhaps a 'disallow' in the robots.txt?
stevie_d — 2013-01-03T16:38:31-05:00 — #2
What you need to do is to tell Google that one page is a mobile version of the other. Don't block googlebot in robots.txt, because then it won't find the mobile site at all, so won't bring it up in mobile searches.
Taken from http://developers.google.com/webmasters/smartphone-sites/details
On the desktop page, add:
<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.example.com/page-1">
(or you can use
media="handheld" although this isn't as reliable)
and on the mobile page, add:
<link rel="canonical" href="http://www.example.com/page-1">
johntabita — 2013-01-03T17:09:11-05:00 — #3
Thanks for the reply. However, I'm a bit confused about the mobile page vs. the desktop page. Since it's the same site, there's really only one page that's displayed differently for each type of user. What am I missing here?
stevie_d — 2013-01-03T18:11:39-05:00 — #4
The pages have different URLs, therefore they are different pages – eg, the URL for the desktop page is www.example.com/page1 and the URL for the mobile page is m.example.com/page1. Where Google sees two different URLs, it assumes you have two different pages unless you tell it otherwise ... and the mobile page probably has a much higher content:noise ratio, faster download times etc, meaning that it thinks the mobile page is a better bet (there's a lesson in there somewhere). You may think it's the same page, it may even be created from the same entry in the database, but when it shows up with a different URL, it's a different page.
That's why you put the
alternate link on the 'real' page, to flag up that the other page is just the mobile version of it, and the
canonical link on the 'mobile' page, to direct search bots back to the main page for non-mobile users.
johntabita — 2013-01-03T18:46:48-05:00 — #5
I assume I must do this for every page, not just the index page? Again, thanks for your help.
stevie_d — 2013-01-04T04:03:45-05:00 — #6
Yes, every page that appears in both the desktop and mobile versions of the site needs this treatment. If you're using any sort of decent CMS or PHP template then you should be able to get those lines added automatically.