{# Reusable template for showing a blog post content #} {% macro blog_entry(post, from=None) %} {% if from == "index" %} {{ post["subject"] }}

{% endif %}

{# TODO #} {% if post["photo"] %} {% elif post["avatar"] %} {% else %} {% endif %}
{{ post["profile"]["username"] }}
Posted by {{ post["profile"]["name"] }} on {{ post["pretty_time"] }}
{{ post["body"] | safe }}

Categories: {% if post["categories"]|length == 0 %} Uncategorized{# TODO hardcoded name #} {% else %} {% endif %}

[ {% if from == "index" %} {% if post["comments"] %}{# Allowed comments #} {{ post["comment_count"] }} comment{% if post["comment_count"] != 1 %}s{% endif %} | Add comment | {% endif %} Permalink {% else %} Blog {% endif %} {% if session["login"] %} | Edit | Delete {% endif %} ]

{% endmacro %}