Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a "normal" website and I am currently developing a mobile version of the site. Because of the complexity of the shown information, I am using a separate domain (mysite.mobi) and no responsive solution. The site is built as a single-page-app using jQuery mobile.

The main workflow is that I am using a custom parameter attached to my main file (mysite.mobi/index.htm#forecast?location_id=1234). It will then fire an AJAX-request and fetch the content corresponding to the forecast for the location_id 1234. The desktop website URL would be something like mysite.com/forecast/1234.

Now I am thinking about how to get my mobile search results displayed in Google searches. According to their recommendations, I should use a link rel=alternate tag in the main page and add a link rel=canonical tag to the mobile site.

There is the problem - as I am using a single page webapp, I only have a single crawlable file on my mobile domain where I could add this tag. However I can not get this tag to reflect the correct location on my main site.

What are the best practices for using a single-page-app and canonical URLs?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Single page apps have a definite downside when it comes to SEO because there is only one landing page. There is no way for you to map crawlable urls one to one between your desktop and mobile sites the way that you have it configured.

You could try to make your AJAX site crawlable using Google's supported method. That would entail changing your mobile urls to mysite.mobi/index.htm#!forecast?location_id=1234 and supporting crawlable urls on the server side like mysite.mobi/index.htm?_escaped_fragment_=location_id=1234 Even Google's crawlable AJAX spec doesn't appear to detail how to set meta tags for you escaped_fragment pages, so canonical tags still wouldn't be supported.

share|improve this answer
    
Thanks! I see the downsides now... But what is the preferred way then if I cannot get canoncial tags to work? Should I block crawlers from my mobile site completely and only let the desktop page show up in search results? When a mobile user gets on my website, I would show him a banner leading him to the mobile site. –  j0nes Feb 20 '13 at 7:45
    
You should auto-redirect to the mobile site based on user-agent. Then if users want to use the full site, give them a link that takes them back (setting a cookie so they stay on the full site). It's not clear what would happen to mobile rankings at that point, but its possible that Google would still send mobile traffic your way. –  Stephen Ostermiller Feb 20 '13 at 11:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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