5

I'm using the Google CSE to search through a multilingual website (german, english, dutch, french).

The Problem is that I want the search to return results only in the language the user is on e.g. www.coolsite.de/en/?q=hotel should only return results in english.

The documentation says:

You can restrict the search to documents written in a particular language (e.g., lr=lang_ja).

so that's exactly what I want to achieve!

But my search still returns german results when lr is set to lang_en (available languages). All my pages have set language in html-Tag like this:

<html lang="en"> or <html lang="de">

they also contain <meta name="language" content="en" /> or <meta name="language" content="de" /> (is this the correct value for the meta? I read that the value should contain the full name of the language?!)

Am I missing something?

2 Answers 2

0

My workaround was to set the hq-Parameter (Appends the extra query terms to the query.) to site:http://www.coolsite.de/[language-I-want-to-search-in]/

It would have also been possible to filter for data contained in my PageMap.

Sign up to request clarification or add additional context in comments.

1 Comment

You're adding this via custom JS?
0

The best solution I can find is to create a separate configuration per language on the same site. Then depending on the language in the URL of my site (.e.g /es/blah for Spanish) I set a different CX value in the call to cse.js. This let's me customise the config for each language and makes Google show the interface in that language too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.