blog.html.twig 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {% extends 'partials/base.html.twig' %}
  2. {% set blog_image = page.media.images[page.header.hero_image] ?: page.media.images|first %}
  3. {% set collection = page.collection() %}
  4. {% set show_breadcrumbs = header_var('show_sidebar', '/blog')|default(true) %}
  5. {% set show_sidebar = header_var('show_sidebar')|default(true) %}
  6. {% set show_pagination = header_var('show_sidebar')|default(true) %}
  7. {% block stylesheets %}
  8. {% do assets.addCss('theme://css/bricklayer.css') %}
  9. {{ parent() }}
  10. {% endblock %}
  11. {% block javascripts %}
  12. {{ parent() }}
  13. {% do assets.add('theme://js/bricklayer.min.js') %}
  14. {% endblock %}
  15. {% block hero %}
  16. {% include 'partials/hero.html.twig' with {id: 'blog-hero', content: page.content, hero_image: blog_image} %}
  17. {% endblock %}
  18. {% block body %}
  19. <section id="body-wrapper" class="section blog-listing">
  20. <section class="container {{ grid_size }}">
  21. {% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
  22. {% include 'partials/breadcrumbs.html.twig' %}
  23. {% endif %}
  24. {% embed 'partials/layout.html.twig' with {blog: page} %}
  25. {% block item %}
  26. <div class="bricklayer">
  27. {% for child in collection %}
  28. {% include 'partials/blog-list-item.html.twig' with {blog: page, page: child} %}
  29. {% endfor %}
  30. </div>
  31. {% if show_pagination and config.plugins.pagination.enabled and collection.params.pagination %}
  32. <div id="listing-footer">
  33. {% include 'partials/pagination.html.twig' with {base_url: page.url, pagination: collection.params.pagination} %}
  34. </div>
  35. {% endif %}
  36. {% endblock %}
  37. {% block sidebar %}
  38. {% include 'partials/sidebar.html.twig' %}
  39. {% endblock %}
  40. {% endembed %}
  41. </section>
  42. </section>
  43. <script>
  44. //Bricklayer
  45. var bricklayer = new Bricklayer(document.querySelector('.bricklayer'))
  46. </script>
  47. {% endblock %}