My boss is having me look at various ways to improve our site’s SEO and I’ve been doing some research on it. I’m aware that search engines like mobile-friendly sites and I used Google’s Webmaster Tools, finding that it considers our site to be mobile-friendly. However, we lack an adequate robots.txt file.
What we want to do is avoid getting the same page indexed twice (as desktop and mobile versions), and he recommended that I include our site’s mobile URLs in the robots.txt file. However, will doing this damage our site’s ranking? I get that files listed under robots.txt shouldn’t be indexed, which raises concerns about whether or not people will be able to see results for our site when they search for it on their phones.
2
Answers
Although I would not recommend having two different files or URLs for mobile/regular sites,as the official google blog recommends:
Having said that, since you already have mobile versions and would like to block google bot from indexing multiple versions of the same URL:
Blocking Googlebot-Mobile from desktop site
http://searchengineland.com/5-tips-for-optimal-mobile-site-indexing-107088
Robots.txt disallows crawling, not indexing.
So if you would block your mobile URLs, bots would never be able to even see that you have a mobile site, which is probably not what you want.
Alternative
Tell bots what the links are about. Based on this declaration, bots can decide what they want to do with these URLs.
You can do this by providing the link types
alternate
andcanonical
:alternate
(defined in the HTML5 spec), to denote that it’s an "alternate representation of the current document".canonical
(defined in RFC 6596), to denote that the pages are the same, or that they only have trivial differences (e.g., different HTML structure, table sorted differently etc.), or that one is the superset of the other.So if you want to use the URLs from the desktop site as canonical, you would use
"alternate canonical"
to link from mobile to desktop, and"alternate"
to link from desktop to mobile. You can see an example in my answer to the Webmasters question Linking desktop and mobile pages.