modular.html.twig 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {% extends 'partials/base.html.twig' %}
  2. {% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}
  3. {% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
  4. {% block javascripts %}
  5. {% if show_onpage_menu %}
  6. {% do assets.add('theme://js/singlepagenav.min.js') %}
  7. {% endif %}
  8. {{ parent() }}
  9. {% endblock %}
  10. {% block bottom %}
  11. {{ parent() }}
  12. {% if show_onpage_menu %}
  13. <script>
  14. // singlePageNav initialization & configuration
  15. $('ul.navigation').singlePageNav({
  16. offset: $('#header').outerHeight(),
  17. filter: ':not(.external)',
  18. updateHash: true,
  19. currentClass: 'active'
  20. });
  21. </script>
  22. {% endif %}
  23. {% endblock %}
  24. {% block header_navigation %}
  25. {% include 'partials/navigation.html.twig' %}
  26. {% include 'partials/taxonomylist.html.twig' with { taxonomy: 'tag'} %}
  27. {% endblock %}
  28. {% block hero %}
  29. {% for module in page.collection() if module.template == 'modular/hero' %}
  30. <div id="{{ _self.pageLinkName(module.menu) }}"></div>
  31. {{ module.content }}
  32. {% endfor %}
  33. {% endblock %}
  34. {% block body %}
  35. {% for module in page.collection() if module.template != 'modular/hero' %}
  36. {{ module.content }}
  37. {% endfor %}
  38. {% endblock %}