Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Language specific pages

Started by Marten 9 years ago · 2 replies · 1580 views
9 years ago

Hi,

I'm a great fan of grav and crafted our company website with custom a theme.
rocketbase.io

Currently I'm facing a problem, that we would like to support multiple languages (mainly German and English) but would like to hide some pages from a particular language.
The theme handles modulars and the navigation is drawed by this code:

TWIG
{% macro loop(page) %}
    {% for p in page.children.visible %}
        {% set current_page = (p.active or p.activeChild) ? 'selected' : '' %}
        {% if p.children.visible.count > 0 %}
            <li class="has-children {{ current_page }}">
                <a href="{{ p.url }}">
                    {% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
                    {{ p.menu }}
                </a>
                <ul>
                    {{ _self.loop(p) }}
                </ul>
            </li>
        {% else %}
            <li class="{{ current_page }}">
                <a href="{{ p.url }}">
                    {% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
                    {{ p.menu }}
                </a>
            </li>
        {% endif %}
    {% endfor %}
{% endmacro %}

How could I insure that the availability of an translation is been checked?
In some folders I current only placed modular.de.md but the navigation also draws these in english version...

I've read your docs but didn't found any hint how to handle this issue.

Thanks in advance
Marten

9 years ago

If you don't want a page to show up at all for a particular language, simply create the page for the language (e.g. yourpage.de.md) and set published: false.

Did you try that?

9 years ago

Hi rhuk,
thanks that works!
Cheers

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 1 year ago
6 1662 1 year ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1234 2 years ago
Content & Markdown · by Jan L'Am, 2 years ago
4 1098 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 1001 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1491 2 years ago