blog.html.twig 2.2 KB

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