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

Navigation dropdown menu according to lang

Started by Muut Archive 11 years ago · 1 replies · 308 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 Deleted User, 9 years ago
0 1346 9 years ago
Archive · by Muut Archive, 9 years ago
2 933 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago