{# Reusable template for showing a blog post content #} {% from "google-ads.inc.html" import leaderboard %} {% macro blog_entry(post, from=None) %} {% if from == "index" %} {{ post["subject"] }}

{% else %} {% include "blog/sibling-links.html" %}

{% endif %}

{% if post["avatar"] %} {{ post['profile']['name'] }} {% elif post["photo"] %} {{ post['profile']['name'] }} {% else %} {{ post['profile']['name'] }} {% endif %}
{{ post["profile"]["username"] }}
Posted by {{ post["profile"]["name"] }} on {{ post["pretty_time"] }}
{{ post["rendered_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 %} ]

{# Show the Google ad after the first post. #} {% if from == "index" and post["position_index"] == 1 %} {{ leaderboard() }} {% endif %} {% if from != "index" %} {% include "blog/sibling-links.html" %}

{{ include_page("comment.partial_index", thread="blog-"+post["post_id"]|string, subject=post["subject"], ) | safe }} {% endif %} {% endmacro %}