1

How can I give another localization its own "Single" as homepage. My main language has its own very unique homepage but for the other languages I need all the fields and HTML/CSS of my about us page. I want to do this without adding all the fields to some other tab in my homepage.

Is there any possible way to make this happen. I tried already to set the homepage for the main language open. Created a new Single for the other language but I dont have the option to set it as homepage for the current language.

1 Answer 1

1

You don't need to use the "This is for the homepage" checkbox at all. All it does is to (1) set up a route to the entry template specified in the section settings and (2) make the entry model available to this template from an entry variable.

You can just deselect this option and configure the above manually. The simplest way to set up a route for the homepage is to create a template index.html in craft/templates/ and Craft picks it up automatically for hompage requests (→ see pt. 6 in the routing docs).

You can now query for the entry model (your "single") depending on the requested locale to solve (2) and then include a template partial into the index.html to solve (1).

{% if craft.locale == 'fr' %}
    {% set entry = craft.entries.section('home_fr').first() %}
    {% include '_pages/home_fr' %}
{% elseif craft.locale == 'de' %}
    {% set entry = craft.entries.section('home_de').first() %}
    {% include '_pages/home_de' %}
{% else %}
    {% set entry = craft.entries.section('home').first() %}
    {% include '_pages/home' %}
{% endif %}

Your Answer

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

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