beeware.github.io/templates/macros/blog.html
2023-04-14 07:09:15 +08: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 post.mastodon_handle %}
<a href="https://{{ post.mastodon_handle.split('@')[2] }}/@{{ post.mastodon_handle.split('@')[1] }}">{{ post.author or post.mastodon_handle }}</a>
{% elif post.twitter_handle %}
<a href="https://twitter.com/{{ post.twitter_handle }}">{{ post.author or post.twitter_handle }}</a>
{% else %}
{{ post.author }}
{% endif %}
{{ t_on }} {{ post.pub_date.strftime('%-d %B %Y') }}
</p>
{% endif %}
{{ post.body }}
{% endmacro %}