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.

Themes & Styling

Multi-language links in Agency Theme

Solved by Gez View solution

Started by Peter Simkovic 9 months ago · 22 replies · 209 views
8 months ago

When I use “NAV1.TITLE” it shows 9 times first title “Služby”.

8 months ago Solution

you still use loop via twig probably, lets try not using twig to generate links, simply use html a tag like

TWIG
<li><a class="page-scroll" href="{{ 'NAV1.URL'|t }}">{{ 'NAV1.TITLE'|t }}</a></li>
<li><a class="page-scroll" href="{{ 'NAV2.URL'|t }}">{{ 'NAV2.TITLE'|t }}</a></li>
<li><a class="page-scroll" href="{{ 'NAV3.URL'|t }}">{{ 'NAV3.TITLE'|t }}</a></li>

instate of

TWIG

                {% for link in site.links %}
                    {% if link.url | contains('http') %}
                        {% set domain = '' %}
                            {% elseif link.url | contains('#') %}
                            {% set domain = '' %}
                                {% else %}
                                {% set domain = base_url_absolute %}
                                {% endif %}
                                <li><a class="page-scroll" href="{{ domain }}{{ 'NAV.URL'|t }}" {% if link.url | contains('http') %}target="_blank"{% endif %}>{{ 'NAV.TITLE'|t }}</a></li>
                            {% endfor %}

later we can shorten code by using loop

while at it, i dont understand the reason we use "home#sluzby" instate of "#sluzby"

last edited 10/09/25 by Gez

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 195 2 months ago
Themes & Styling · by Ian, 2 months ago
3 91 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 451 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 45 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 125 3 months ago