3

I'm trying to code my sites mobile version. it will be like this: www.example.com => mobile.example.com

im using this alternate tag in desktop page; thats ok:

<link rel="alternate" media="only screen and (max-width: 800px)"
href="http://mobile.example.com/first_link.html">

and using this canonical tag in mobile version; thats ok too:

<link rel="canonical" href="http://www.example.com/first_link.html" />

now.. should i also ban the mobile pages via robots.txt file? (by adding robots.txt file to the root of mobile directory; with Disallow: / line)

because if not, google will index both www. and mobile. url's.. (all contents are the same; the only difference is: design)...

what sould i do? using canonical/alternate tags will be enough to no-indexing? or should i also use robots.txt to disallow mobile directory?

1 Answer 1

3

The canonical tag is enough, as it lets Google know which page should be indexed. It is basically a way of saying "Hey, these pages are extremely similar. Here is the page that should take precedence."

Preventing Google from crawling your mobile links will cause more harm than good. Example: If a mobile user shares a mobile link to your website, you don't want to be caught in a situation where Googlebot can't crawl that link.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.