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 →

Navigation dropdown menu according to lang

Started by Muut Archive 11 years ago · 1 replies · 452 views
11 years ago

♪ Bonsoir

i am trying to get navigation dropdown menu according to langswitcher.current (= current language of page) in the following navigation.html.twig part of the code
(where dropdown collection is described... correct if wrong):

TWIG
<ul class="navigation">
    {% if theme_config.dropdown.enabled %}
        {{ _self.loop(pages.) }}
    {% else %}

What should I write in place of pages (in {{ _self.loop(pages.) }}) to restrict to current language of page and get to the point ?

Sorry that my coding knowledge is not sufficient enough

Thanks in advance for help ☆

11 years ago

Ok I got to the point! ♪ Hurrah ! ! ! ☆

It is not really the way I wanted (see above ...) but it works.

Solution:

for each post, whatever the original 3 versions:

  • one in french (1st language): item.fr.md
  • one in japanese (2nd language): item.ja.md
  • one in english (3rd language): item.en.md

If the post is avalaible in the 3 languages, no problem.

if the post is available in fr only :
in header of files not to be displayed in menus and body:

  • item.ja.md
    and
  • item.en.md

set 2 new parameters to:
visible: false (so that it do not appear in the navigation bar)
and
published: false (so it is not displayed in page).

Then every thing is fine ! ! ! !

ok it'a little bit heavy to have each time 3 .md documents

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 673 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago