1 | {% include 'pagerMacros.html' %}
|
2 | {# use renderBlogPosts to show all pieces as full posts on a page #}
|
3 |
|
4 | {% macro renderBlogPosts(pieces) %}
|
5 | {% if pieces %}
|
6 | {% for piece in pieces %}
|
7 | {{ renderBlogPost(piece, { edit: false }) }}
|
8 | {% endfor %}
|
9 | {% else %}
|
10 | <h4>{{ __('There are no blog posts yet.') }}</h4>
|
11 | {% endif %}
|
12 | {% endmacro %}
|
13 |
|
14 | {% macro renderBlogPost(piece, options = {}) %}
|
15 | <div class="apos-blog-post">
|
16 | <div class="apos-blog-post-heading">
|
17 | <h4><a href="{{ piece.url }}">{{ piece.title | e }}</a></h4>
|
18 | <div class="blog-title-divider"></div>
|
19 | <h6>{{ piece.publishedAt | date("MMM DD, YYYY") }}</h6>
|
20 | </div>
|
21 | <div class="apos-blog-post-body">{{ aposArea(piece, 'body', { edit: options.edit }) }}</div>
|
22 | {% if piece.tags %}
|
23 | <div class="apos-blog-tags">
|
24 | {{ __('File under') }}: {{ piece.tags|join(', ') }}
|
25 | </div>
|
26 | {% endif %}
|
27 | </div>
|
28 | {% endmacro %}
|
29 |
|
30 | {# ...or use renderBlogPostPreviews to show previews of all pieces on a page (date and title) #}
|
31 |
|
32 | {% macro renderBlogPostPreviews(pieces) %}
|
33 | {% if pieces %}
|
34 | {% for piece in pieces %}
|
35 | {{ renderBlogPostPreview(piece) }}
|
36 | {% endfor %}
|
37 | {% else %}
|
38 | <h4>{{ __('There are no blog posts yet.') }}</h4>
|
39 | {% endif %}
|
40 | {% endmacro %}
|
41 |
|
42 | {% macro renderBlogPostPreview(piece) %}
|
43 | <div class="apos-blog-post-preview">
|
44 | <div class="apos-blog-post">
|
45 | <div class="apos-blog-date">
|
46 | <h4><a href="{{ piece.url }}">{{ piece.publishedAt | date("MMM") }}</a></h4>
|
47 | <h3><a href="{{ piece.url }}">{{ piece.publishedAt | date("DD") }}</a></h4>
|
48 | </div>
|
49 | <div class="apos-blog-title">
|
50 | <h4><a href="{{ piece.url }}">{{ piece.title | e }}</a></h4>
|
51 | </div>
|
52 | {# TODO: add byline once the author field is worked out in A2 #}
|
53 | </div>
|
54 | </div>
|
55 | {% endmacro %}
|