beeware.github.io/templates/macros/blog.html
Luna Meadows cbe4a851dc
Apply suggestions from code review
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2023-04-07 06:21:35 -05:00

23 lines
866 B
HTML

{% from "macros/translation.html" import transbag %}
{% macro render_blog_post(post, from_index=false) %}
{% set t_posted_by = transbag('translate', post.alt, 'posted_by') %}
{% set t_on = transbag('translate', post.alt, 'on') %}
{% if from_index %}
<h2><a href="{{ post|url(alt=post.alt) }}">{{ post.title }}</a></h2>
<p class="meta">
{{ t_posted_by }}
{% if this.mastodon_handle %}
<a href="https://{{ this.mastodon_handle.split('@')[2] }}/@{{ this.mastodon_handle.split('@')[1] }}">{{ this.author or this.mastodon_handle }}</a>
{% elif this.twitter_handle %}
<a href="https://twitter.com/{{ this.twitter_handle }}">{{ this.author or this.twitter_handle }}</a>
{% else %}
{{ post.author }}
{% endif %}
{{ t_on }} {{ post.pub_date.strftime('%-d %B %Y') }}
</p>
{% endif %}
{{ post.body }}
{% endmacro %}