/
blog.html.twig
22 lines (20 loc) · 1.05 KB
/
blog.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{% extends 'partials/base.html.twig' %}
{% set collection = page.collection() %}
{% set collection = page.collection({ items: '@self.children', 'order': {'by': 'date', 'dir': 'desc'} }) %}
{% block content %}
<div id="content">
<h1>{% if page.parent.url == home_url %}<a href="/">home</a>{% else %}<a href="{{page.parent.url}}">{{page.parent.slug}}</a>{% endif %}/{{header.title}}</h1>
{{ content }}
<ul>
{% for child in collection %}
<section class="blogPost">
<div class="title">{% if child.header.title %}<h2>{{ child.title }}</h2>{% endif %}</div>
<div class="date"><a href="{{child.url}}">{{ child.header.date|date("Y-m-d") }}</a></div>
<div class="content {% if not child.header.title %}blurb{% endif %}">
{% include 'partials/' ~ child.template ~ '.html.twig' with {page: child, embed: true} %}
</div>
</section>
{% endfor %}
</ul>
</div>
{% endblock %}