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

Multi-language links in Agency Theme

Solved by Gez View solution

Started by Peter Simkovic 11 months ago · 22 replies · 798 views
10 months ago

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

10 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 stuart young, 2 weeks ago
3 251 2 weeks ago
Themes & Styling · by Sebadamus, 3 weeks ago
5 317 2 weeks ago
Themes & Styling · by martynfoster735, 4 weeks ago
1 310 4 weeks ago
Themes & Styling · by Justin Young, 1 month ago
1 348 1 month ago
Themes & Styling · by Slebeig, 2 months ago
4 474 2 months ago