Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is looking to install the hreflang attribute to improve SEO for different languages on their website. They have checked their account settings and read a blog post on the topic, but they cannot find the hreflang code in the

section of their website.

Solution:
We have reviewed the source code of the client's website and confirmed that the hreflang attributes are correctly placed within the

<head>

section, not the

, which is part of the body element. The hreflang tags are correctly implemented as follows:

<link rel="alternate" hreflang="nl" href="http://tattoo-tijdelijk.nl" /><br /><link rel="alternate" hreflang="de" href="http://tattoo-tijdelijk.nl/de/" /><br /><link rel="alternate" hreflang="en" href="http://tattoo-tijdelijk.nl/en/" /><br /><link rel="alternate" hreflang="fr" href="http://tattoo-tijdelijk.nl/fr/" /><br /><link rel="alternate" hreflang="it" href="http://tattoo-tijdelijk.nl/it/" /><br /><link rel="alternate" hreflang="es" href="http://tattoo-tijdelijk.nl/es/" /><br /><link rel="alternate" hreflang="sv" href="http://tattoo-tijdelijk.nl/sv/" /><br /><link rel="alternate" hreflang="x-default" href="http://tattoo-tijdelijk.nl" />

We also clarified that it is not possible to have two hreflang tags for the same language. If the client needs to target specific countries with the same language, they can add new languages and assign hreflang tags for each by editing WPML's languages table at https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/, and then duplicate content if no translation is needed at https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#how-to-duplicate-pages-and-posts-in-bulk.

If this solution does not seem relevant, please open a new support ticket at our support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Bruno Kos 1 year, 3 months ago.

Assisted by: Bruno Kos.

Author Posts
January 17, 2024 at 7:58 am #15193172

rodid

Good Morning!

In my previous support ticket I did get some help for my seo. I want to install the Hreflang so Google will better understand the different languages we have on our website.

Right now I see all the settings in my account are fine. But when I check where the hreflang code is for my website I can't find it below the <header>

I also did read the whole blog post and my seo specialist did a check but it is not installed right now. I hope you guys can help me because we are making big steps already with seo for different countries thanks to your plugin!

But this is an very important step to do it way better.

Website: hidden link

Greetins,

Rodi de Haas

Scherm­afbeelding 2024-01-17 om 08.54.45.png
January 17, 2024 at 8:23 am #15193292

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

If I check the source of your site, view-source:hidden link, I see this in the head element:

<link rel="alternate" hreflang="nl" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="de" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="it" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="es" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="sv" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />

And this is correct.

The `hreflang` attribute should be placed in the `<head>` section of an HTML document, specifically within the `<link>` element in the `<head>` section. The purpose of the `hreflang` attribute is to indicate the language and regional targeting of a webpage. Placing it in the `<head>` section helps search engines understand the language and geographical targeting of the page, which can be important for SEO (Search Engine Optimization) and ensuring that users are directed to the correct version of a page based on their language and location preferences.

So it should not end up in header which is placed within the body element.

Regards,
Bruno Kos

January 22, 2024 at 8:46 am #15209815

rodid

Good morning,

I understand and did ask it to my seo specialist worker. He said We need to add the location also. So by example fr-FR. I'm scared this will have negative effect on my seo. Could please help me step by step so we won't lose our seo positions.

We have .nl bu in Belgium they als speak dutch. So we need a nl-BE right? I was thinking about the following:

nl-NL | Netherlands
nl-BE | Belgium north
fr-FR | France
fr-BE | Belgium south
de-DE | Germany
de-AT | Oostenrijk
de-CH | Zwitserland
en-UK | England
es-ES | Spain
it-IT | Italy
sw-SV | Sweden

January 22, 2024 at 9:04 am #15209968

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I am not sure what do you mean by "location", the language is already specified in hreflang.

Can you send an example on how should this look like?

January 22, 2024 at 9:30 am #15210062

rodid

It's about the region of a country. It's something very normal for hreflang and very important right? See: https://wpml.org/documentation/support/adding-hreflang-wordpress/.

Right now we have by example a dutch website and in Belgium they also speak dutch. But you can't find this back in the hreflang. We just have .nl right now. But we need to tell in the hreflang that our website is also for Belgium so Google understand it.

Do you know a colleague who got experience for Europe hreflang settings maybe? it's very very important for us.

Thank you and have a Wonderfull Monday!

January 22, 2024 at 10:15 am #15210353

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Your hreflangs as correct they are set now, there is nothing here to be added or removed.

Also you can't have 2 hreflangs for the same language.

If you need to target specific countries even though with the same languages, you can add new languages and assign hreflangs for each of these:
https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/ and then duplicate languages if no translation is needed: https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#how-to-duplicate-pages-and-posts-in-bulk