0

I've been trying to figure out how to have a translated node promoted on the front page to be displayed according to the visitor chosen language. So basically I have one article promoted on the front page. It has a french translation (which I also set as promoted on the front page).

  • I want my visitor to only see the english version of my article (node/1) when on mysite.com/en
  • I want my visitor to only see the french version of my article (node/3) when on mysite.com/fr

The problem:

The source node (en, node/1) has a translated version (fr, node/3). Both are set to be promoted on front page. But they are both showing up on the homepage whereas I would like to have the nodes being only displayed once on the related language (mysite.com/fr or mysite.com/en).

enter image description here

Everything has been set up using Internationalization.

UPDATE

You will think I was posting without googling first but I can ensure you I've been struggling with this for hours. Finally found the solution here: https://stackoverflow.com/questions/5168289/multiple-frontpages-in-mutiple-languages/6803625#6803625

1
  • 1
    you can answer your own question explaining what did you do (all steps of the linked solution?).
    – sanzante
    Mar 19, 2017 at 15:58

1 Answer 1

1

I'm assuming this question is about D7 ...

The relative URL to display as the front page is specified within admin/config/system/site-information. If you want to be able to specify a value for it that is different for each of the site's languages, make sure you have made it a "multilingual" variable (it should say "This is a multilingual variable.") in the description of that variable on that page.

Refer to the community documentation about Variable translation for details about how to translate text and settings that are stored in Drupal as variables. Here is a quote from that page:

The Variable translation module, part of the Internationalization (i18n) package, allows you to translate text and settings that are stored in Drupal as variables. These variables include text such as 'site name' and 'site slogan', as well as settings like 'Default front page' and 'Default 404 page'.

The Variable translation module has a dependency on the Variable module.

And these are the specific steps required to make a variable multilangual (mentioned on that community page):

  1. Enable the Variable translation module included with the Internationalization package
  2. Go to Administration > Configuration > Regional and language > Multilingual settings
  3. Click on the Variables tab
  4. Select the variables that will be multilingual
  5. Click Save configuration button

Obviously, in this case in step 4 the variable to be selected is "Default front frontpage", within "Site information".

Finally, this is what remains to be done (another quote from that same page):

Once you have the correct settings, they'll be marked with "This is a multilingual variable" when you go to the corresponding administration pages (Figure 2). You must switch the site language while in the administration pages to set the variables for each language. A language switcher link will appear at the top of each administrative page that has multilingual variables.

"That's all" what's needed to specify a language specific value for the frontpage of your site ...

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.