nav.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <nav class="navbar navbar-expand-md navbar-light fixed-top navbar-custom {% if page.nav-short %}top-nav-short-permanent{% endif %}">
  2. {%- if site.title-img -%}
  3. <a class="navbar-brand navbar-brand-logo" href="{{ '' | absolute_url }}"><img alt="{{ site.title }} Logo" src="{{ site.title-img }}"/></a>
  4. {%- elsif site.title -%}
  5. <a class="navbar-brand" href="{{ '' | absolute_url }}">{{ site.title }}</a>
  6. {%- endif -%}
  7. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false" aria-label="Toggle navigation">
  8. <span class="navbar-toggler-icon"></span>
  9. </button>
  10. <div class="collapse navbar-collapse" id="main-navbar">
  11. <ul class="navbar-nav ml-auto">
  12. {%- for link in site.navbar-links -%}
  13. {%- if link[1].first %}
  14. <li class="nav-item dropdown">
  15. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ link[0] }}</a>
  16. <div class="dropdown-menu" aria-labelledby="navbarDropdown">
  17. {%- for childlink in link[1] -%}
  18. {%- for linkparts in childlink %}
  19. <a class="dropdown-item" href="{{ linkparts[1] | relative_url }}">{{ linkparts[0] }}</a>
  20. {%- endfor -%}
  21. {%- endfor %}
  22. </div>
  23. </li>
  24. {% else %}
  25. <li class="nav-item">
  26. <a class="nav-link" href="{{ link[1] | relative_url }}">{{ link[0] }}</a>
  27. </li>
  28. {%- endif -%}
  29. {%- endfor -%}
  30. </ul>
  31. </div>
  32. {% if site.avatar and (layout.show-avatar or page.show-avatar) %}
  33. <div class="avatar-container">
  34. <div class="avatar-img-border">
  35. <a href="{{ '' | absolute_url }}">
  36. <img alt="Navbar avatar" class="avatar-img" src="{{ site.avatar | relative_url }}" />
  37. </a>
  38. </div>
  39. </div>
  40. {% endif %}
  41. </nav>