URL structure for multilingual websites

Ad

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.

Ad

Answer

Ad

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.

Ad
source: stackoverflow.com
Ad