Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i Create Submenu #34

Closed
saleheenkhan opened this issue Apr 19, 2018 · 2 comments
Closed

How can i Create Submenu #34

saleheenkhan opened this issue Apr 19, 2018 · 2 comments

Comments

@saleheenkhan
Copy link

Can you help me To figure out How can i make submenus work.

Here is My Nav codes

<div class="collapse navbar-collapse flex-sm-row-reverse" id="headernav">
            <ul class=" nav navbar-nav menu">
              {% for p in: index.children.find_all_by(hidden: false published: true) do: %}
                <li class="nav-item">
                    <a class="nav-link" href="/{{ p.fullpath }}">{{ p.title }}</a>
                </li>
              {% end for %}
            </ul>
        </div

Using Above codes the sub pages are not showing on navigation.

Thanks in advance

@GarPit
Copy link
Contributor

GarPit commented Apr 20, 2018

Hey, @saleheenkhan.

There is no special kind of nav tag. So you should generate it manually like:

    {% for p in: index.children.find_all_by(hidden: false published: true) do: %}
            <li class="nav-item">
                <a class="nav-link" href="/{{ p.fullpath }}">{{ p.title }}</a>
                {% if !is_empty(p.children) then: %}
                    <ul>
                       {% for subchild in: p.children.find_all_by(published: true hidden: false) do: %}
                          ...
                       {% end for %}
                    </ul>
                {% end if %}
            </li>
      {% end for %}

And etc. (I guess there's almost no menu in the world with more than 3 levels)

@saleheenkhan
Copy link
Author

Works Fine.. Thank you for the Help..

@GarPit GarPit closed this as completed Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants