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 4 replies, has 2 voices.

Last updated by agnesH-3 2 weeks, 3 days ago.

Assigned support staff: Bobby.

Author Posts
September 30, 2019 at 3:11 pm #4665853

agnesH-3

I am trying to:
Build a WPML site with two different languages (English and German). the primary language is German, meaning, that German is shown if the user goes too hidden link and only English is shown, if the user goes to hidden link

I expected to see:
Correctly indexed search results.

Instead, I got:
On German Google, the English page is indexed (English meta descriptions and title)

I already searched the forums and found similar issues:
https://wpml.org/forums/topic/browser-language-redirect-may-affect-your-sites-indexing/
https://wpml.org/forums/topic/googleresult-shows-a-mix-of-german-and-english-but-linking-to-the-german-pages/#post-2634375

Is there any way (JS/PHP filter) to detect the Google bot and NOT use browser redirection? If there is no filter, can you point me to the specific code line where the browser redirect is happening so I can manually adjust the code for now? Is there maybe any other workaround, while keeping browser redirection on?

Thanks!

September 30, 2019 at 11:16 pm #4667743

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

As you have read in this thread here https://wpml.org/forums/topic/googleresult-shows-a-mix-of-german-and-english-but-linking-to-the-german-pages/#post-2634375 this is happening due to the way Google deals with Browser language redirection.

Unfortunately, there is no workaround for this other than deactivating the Browser Language Redirection.

Additionally, custom work is not within the scope of this forum, therefore, we cannot provide some custom workaround for this.

Here is a link to experienced 3rd party developers that are familiar with WPML.
-> https://wpml.org/contractors/

Please find the code located here:
sitepress-multilingual-cms/src/js/browser-redirect/WPMLBrowserRedirect.js

October 1, 2019 at 8:02 am #4669341

agnesH-3

Hey Bobby,

I'm a developer myself, so I'll be attempting to fix it.

However, the folder "src" does not exist. I only get the minified dist-folder. How can I download the src folder?

Thanks

October 1, 2019 at 5:10 pm #4674267

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

You should be able to find it in the following directory:

sitepress-multilingual-cms/dist/js/browser-redirect/app.js
October 2, 2019 at 8:35 am #4677831

agnesH-3

The dist folder only contains the minified versions, which I cannot edit.

I made a solution myself, using the wpml_enqueue_browser_redirect_language hook in PHP, detecting the user agent and then not adding the wpml JS for redirection. Maybe this helps others.

Thanks!