Search engines love multiple-languages and are super flexible
Google and Bing are very flexible when it comes to structuring a website with multiple languages. The first thing you should know about these types of sites is that you can either target a language or a language + country.
Country Based Content
Targetting a country is more ideal for sites that sell services or products because then you can set the currency or have specific information on where to buy the product or service, and run country-specific promotions, a good example is https://www.samsung.com/uk/
On the root domain (https://www.samsung.com/
) and within <head>
I would expect to see
<html lang="en">
<link rel="alternate" href="https://www.samsung.com/uk/" hreflang="en-GB" />
Then on the URL path UK (https://www.samsung.com/uk/
) I would expect to see:
<html lang="en-GB">
<link rel="alternate" href="https://www.samsung.com/" hreflang="x-default" />
<link rel="alternate" href="https://www.samsung.com/us/" hreflang="en-US" />
Wait a minute... what's x-default?
You may have noticed and thinking what is x-default?, this markup tells search engines, that should the site visitor not be either en-US
or en-GB
then the root is the default for all other unmatched languages and countries.
Okay, gotcha but what is HTML Lang?
The <html lang="en-GB">
is primarily for users, not search engines, so essentially it tells the browser what language is set to the page, ideally from an accessibility point of view, you should use both lang and hreflang.
But... I don't want to target countries, I want to target languages
Okay, chill your beans. Targetting languages is as simple as removing the country ISO, the so en-GB
becomes en
and URLs should be renamed from /uk/
to /en/
If you main visitors or customers are English then you can use the root domain for that language, there's no need to create /en/
since you will be telling Google and Bing on other pages the alternative for /en/
for example on page /de/
I would expect to see this:
<html lang="de">
<link rel="alternate" href="https://www.samsung.com/" hreflang="x-default" />
<link rel="alternate" href="https://www.samsung.com/" hreflang="en" />
However, you could also use both /
and /en/
for English, both are acceptable methods. Using /
for unmatched countries could be a unique page where users can pick a language, for example:
Tackling duplicate content
When using identical pages e.g (en-GB + en-US) or (x-default + en) it is important to use rel canonical to inform Google and Bing that X is duplicate of Y.
For example, if we use /
/uk/
and /us/
, and all pages are identical or almost identical then I would expect to see this in the head:
Root /
<html lang="en">
<link rel="alternate" href="https://www.example.com/us/" hreflang="en-US" />
<link rel="alternate" href="https://www.example.com/uk/" hreflang="en-GB" />
<link rel="canonical" href="https://example.com/" />
UK Page /uk/
<html lang="en-GB">
<link rel="alternate" href="https://www.example.com/" hreflang="x-default" />
<link rel="alternate" href="https://www.example.com/us/" hreflang="en-US" />
<link rel="canonical" href="https://example.com/" />
US Page /us/
<html lang="en-US">
<link rel="alternate" href="https://www.example.com/" hreflang="x-default" />
<link rel="alternate" href="https://www.example.com/uk/" hreflang="en-GB" />
<link rel="canonical" href="https://example.com/" />
But if you want to use /us/
to be the master, and everything else to be duplicate then you change the canonical from https://example.com/
to https://example.com/us/
Please Note
This answer contains elements outside the realms of what has been asked, primarily canonical pages and country-specific pages, this has been added as an EXTRA and to help other users that may be considering to use languages or languages + countries.