Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

Language specific pages

Started by Marten 9 years ago · 2 replies · 1024 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, 8 months ago
6 97 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 185 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 61 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 255 1 year ago