navigation.html.twig 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {% macro loop(page) %}
  2. {% for p in page.children.visible %}
  3. {% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
  4. <li class="{{ current_page }}">
  5. <a href="{{ p.url }}">
  6. {% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
  7. {{ p.menu }}
  8. </a>
  9. {% if p.children.visible.count > 0 %}
  10. <ul>
  11. {{ _self.loop(p) }}
  12. </ul>
  13. {% endif %}
  14. </li>
  15. {% endfor %}
  16. {% endmacro %}
  17. <ul class="navigation">
  18. {% if theme_config.dropdown.enabled %}
  19. {{ _self.loop(pages) }}
  20. {% else %}
  21. {% for page in pages.children.visible %}
  22. {% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
  23. <li class="{{ current_page }}">
  24. <a href="{{ page.url }}">
  25. {% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
  26. {{ page.menu }}
  27. </a>
  28. </li>
  29. {% endfor %}
  30. {% endif %}
  31. {% for mitem in site.menu %}
  32. <li>
  33. <a href="{{ mitem.url }}">
  34. {% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
  35. {{ mitem.text }}
  36. </a>
  37. </li>
  38. {% endfor %}
  39. {% if config.plugins.login.enabled and grav.user.username %}
  40. <li><i class="fa fa-lock"></i> {% include 'partials/login-status.html.twig' %}</li>
  41. {% endif %}
  42. </ul>