Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Need help with sub menus and add classes

  • #3890
    Avatar photo[anonymous]

    Hi, it may be too complicated, but I am trying to figure out how I can implenment this block of code into Publii’s sub menus. I understand how to create the basic Publii menu, but these sub menus with the classes I have in my HTML are confusing me. Is there any way to do this?

    <ul class="nav navbar-nav">
        <li class="nav-item">
            Home
        
        <li class="nav-item dropdown">
            Start Here&nbsp;
            
        
        <li class="nav-item">Sermons
        <li class="nav-item">Events
        <li class="nav-item">Contact
    

    and

    {{#unless level}}
    <nav>
    {{/unless}}
        <ul{{#if level}} class="submenu submenu-level-{{level}}"{{else}} class="menu menu-level-1"{{/if}}>
            {{#each items}}
                <li{{menuItemClasses}}>
                {{#if link}}
                {{label}}
                {{else}}
                <span{{#if title}} title="{{title}}"{{/if}}>{{label}}</span>
                {{/if}}
    
                {{#if items}}
                    {{> menu}}
                {{/if}}
            
            {{/each}}
        
    {{#unless level}}
    </nav>
    {{/unless}}
    

    Thank you,

    Nick

    #3947
    Avatar photo[anonymous]

    Hi, I’d like to try to set it up like this:

    {{#unless level}}
                    <nav>
                    {{/unless}}
                        <ul class="nav navbar-nav">
                            {{#each items}}
                                <li class="nav-item">
                                {{#if link}}
                                    {{label}}
                                {{/if}}
                    
                                {{#if items}}
                                    <li class="nav-item dropdown">
                                        {{label}}&nbsp;
                                        
                                    
                                {{/if}}
                            
                            {{/each}}
                        
                    {{#unless level}}
                    </nav>
                    {{/unless}}