{% extends 'base.html' %} {% block header %}

{% block title %}Posts{% endblock %}

{% if g.user %} New {% endif %} {% endblock %} {% block content %} {% for post in posts %}
{% if post['title'].__len__() > 80 %}

{{ post['title'][:80] }}

{% else %}

{{ post['title'] }}

{% endif %}
by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}
{% if g.user['id'] == post['author_id'] %} Edit {% endif %}

{{ post['body'] }}

{% if not loop.last %} {# Separate posts with a line #}
{% endif %} {% endfor %} {% endblock %}