blog.html.twig 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. {% endblock %}
  16. {% block hero %}
  17. {% include 'partials/hero.html.twig' with {id: 'blog-hero', content: page.content, hero_image: blog_image} %}
  18. {% endblock %}
  19. {% block body %}
  20. <section id="body-wrapper" class="section blog-listing">
  21. <section class="container {{ grid_size }}">
  22. {% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
  23. {% include 'partials/breadcrumbs.html.twig' %}
  24. {% endif %}
  25. {% embed 'partials/layout.html.twig' with {blog: page} %}
  26. {% block item %}
  27. <div class="bricklayer">
  28. {% for child in collection %}
  29. {% include 'partials/blog-list-item.html.twig' with {blog: page, page: child} %}
  30. {% endfor %}
  31. </div>
  32. {% if show_pagination and config.plugins.pagination.enabled and collection.params.pagination %}
  33. <div id="listing-footer">
  34. {% include 'partials/pagination.html.twig' with {base_url: page.url, pagination: collection.params.pagination} %}
  35. </div>
  36. {% endif %}
  37. {% endblock %}
  38. {% block sidebar %}
  39. {% include 'partials/sidebar.html.twig' %}
  40. {% endblock %}
  41. {% endembed %}
  42. </section>
  43. </section>
  44. <script>
  45. //Bricklayer
  46. var bricklayer = new Bricklayer(document.querySelector('.bricklayer'))
  47. </script>
  48. {% endblock %}