Sign in

Need help with sub menus and add classes

  • This topic has 1 reply, 1 voice, and was last updated 10 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3890
    nicholasoneil

    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
    nicholasoneil

    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}}

     

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.