skip to Main Content

I’m developing a SPA web app and it will support various languages. It is build with AngularJS and I am using angular-translate to provide i18n.

But I am struggling a little bit with how the URL structure should be. I do no plan on using either gTLDs nor ccTLDs, so that leaves me with three options.

  • Use query params: ?locale=en-us
  • Use url paths: /en-us/page
  • Store the chosen locale in localStorage or a cookie

The first option is a no-go according to Google’s guidelines for web apps SEO. So that leaves me with the last two options.

I have a hard time deciding which is more beneficial, though I am inclined to believe that using url paths would probably be more crawler friendly.

P.S: Not sure if this is the best place to ask such a question either.

2

Answers


  1. The second option is your safest bet as according to https://webmasters.stackexchange.com/questions/59652/what-happens-if-i-try-to-set-a-cookie-on-a-bot cookies are ignored. You can test this yourself by going to the Google Console and fetching your website.

    As of now most crawlers ignore cookies and DO NOT execute JavaScript. This means that they usually just download the html and make their judgements from there.

    Some developers get around the no javascript problem by pre-rendering parts of their content. I haven’t done it personally but you might want to check out https://prerender.io/

    Edit

    As rolandjitsu mentioned google crawls and executes javascript content.

    Login or Signup to reply.
  2. You should go with second option: provide the language tag (and, optionally, region subtags) in the URL path as first segment.

    For the simple reason that it allows you, visitors, and bots to link to specific translations.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search