{% extends 'base.html.twig' %}

{% block content %}
    {% if post %}
        <article class="h-entry">
            <aside>
				<span>
					This is a blog post by
					<a class="p-author h-card" href="/">Joe Carstairs</a>.
				</span>
				<p>
                    Published: <time class="dt-published">{{ post.publishedDate.format('c') }}
                </p>
                {% if post.updatedDate %}}
                    <p>
                        Updated: <time class="dt-updated">{{ post.updatedDate.format('c') }}
                    </p>
                {% endif %}
				<span hidden>
				    <a class="u-url uid" href="{{ url('blog_post', { slug: post.slug }) }}">
						Permalink
					</a>
				</span>
	  		</aside>

			<header>
				<h1 class="p-name">{% apply markdown_to_html %}{{ post.title }}{% endapply %}</h1>
				<p class="p-summary">
				   {% apply markdown_to_html %}{{ post.description }}{% endapply %}
				</p>
			</header>


            {% apply markdown_to_html %}
                <section class="e-content">
                    {{ post.content }}
                </section>
            {% endapply %}
        </article>
    {% else %}
        <section>
            <h1>Post not found</h1>
            <p>I don't have a blog post '{{ slug }}'.</p>
            <p>Go back to <a href="{{ path('blog_posts') }}">Blog</a>.</p>
        </section>
    {% endif %}
{% endblock %}
