Canonical url and og: URL for multilingual site

I've read a lot about these subjects and I know that no solution is perfect for handling a multilingual site. I use a different folder to serve content for different languages, so I have www.example.com/en

, www.example.com/es

etc.

When the user first visits the site in www.example.com

, I pick the best matching language from the Accept-Language

HTTP header and redirect it to the best matching page using the version en

if the language doesn't match. For this reason, www.example.com

there is no real page and it always generates a redirect.

This works very well for both users and search engines, but there is a flaw in this approach, likes to spread in different languages, I want them all to be for www.example.com

If I set og:url

to the root page, referring to the FB crawlers about redirects because it comes from www.example.com

, then it is redirected to www.example.com/en

which is og:url

set to www.example.com

. I want to keep a unified approach like for www.example.com/es

etc. For www.example.com/en

, both must be considered for the primary domain.

My current solution is to change the redirect code this way: when the user agent is facebook, it is never redirected when requested www.example.com

. Use the standard locale or the locale requested by the FB with the parameter fb_locale

.

I also added locale open image tags to tell FB about different locales for my page.

Finally, I kept the canonical url tag with part of the locale, because each language serves its own content in a way that search engines need to understand. This is (more or less) the head part of the home page

<meta content="website" property="og:type" />
<meta content="http://www.example.com/" property="og:url" />    
<meta content="en_US" property="og:locale" />
<meta content="es_ES" property="og:locale:alternate" />
<meta content="fr_FR" property="og:locale:alternate" />
<link href="http://www.example.com/en" rel="canonical" />

      

This way everything seems to work and is similar to how count is used in all languages. I am getting warning from facebook debugger

Mismatch between og: url and canonical url: og: the url tag in the header is not the same URL as the rel = 'canonical' link in html.

Is this setting correct? Will I have a problem with this markup?

A similar question , but he wants to love across the country.

+3


source to share





All Articles