fmartingr.com/templates/macros/blog.html

36 lines
1.1 KiB
HTML

{% macro render_blog_post(post, from_index=false) %}
{% set summary = post.body.html.split('<!-- readmore -->') %}
<article class="blog-post center">
<h1><a href="{{ post|url }}">{{ post.title }}</a></h1>
<div class="info">
Published on {{ post.pub_date }}
</div>
<div class="content">
{% if from_index and summary|length > 1 %}
{{ summary[0] }}
<p class="text-right"><a href="{{ post|url }}">Read more &raquo;</a></p>
{% else %}
{{ post.body }}
{% endif %}
</div>
{% if not from_index and post.edit_comment %}
<h3>Edits</h3>
{{ post.edit_comment }}
{% endif %}
<hr class="light">
</article>
{% endmacro %}
{% macro render_gallery(post) %}
<div class="center">
<h2>Gallery</h2>
<div style="display: flex; justify-content: center; flex-flow: row wrap; ">
{% for attachment in post.children.get("gallery").attachments.order_by("_id") %}
<a href="/blog/{{post._slug}}/gallery/{{attachment._id}}" style="width: 30%">
<img src="/blog/{{post._slug}}/gallery/{{attachment._id}}">
</a>
{% endfor %}
</div>
<hr class="light">
</div>
{% endmacro %}