navigation.html.twig 1.7 KB

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