Dynamic multilevel menu from section?

How to set dynamic multilevel menu? I have no problem with flat (taking sidebar example) but i don’t have idea how add pages as a children in menu (and build this sublevel dinamicaly like 1st level).


pages/about/_index.md (title = “about”)

I use it to list this section as index for children pages (list.html) and then i want to set this pages as children in dropdown menu where _index.md is parent:

    <ul class="dropdown">
        <li><a>Something Else</a></li>

in something_else.md how can I assign parent?

      parent: "_index.md" // <- here I don't know what must be...

I know how to set it in config.toml but i want it to be dynamic or configurable in content .md - using example from docs with menu: main: … throws error in this case and even setting manualy in config is not enough because of the lacking active class (hugo don’t see list page in if condition: $currentPage.HasMenuCurrent “main”).

Sorry for double post, but i solved this.

in menu template i needed to change if statement to:

<li class="{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}active{{ end }}">

and now it is working fine.

Oh, and yaml don’t like tabs - for menu structure i needed to use 2 spaces, not tab.