{% extends 'base.html.twig' %} {% block body_id 'blog_post_show' %} {% block main %}

{{ post.title }}

{{ post.publishedAt|localizeddate('long', 'medium', null, 'UTC') }} {{ post.author.fullName }}

{{ post.content|md2html }} {{ include('blog/_post_tags.html.twig') }}
{# The 'IS_AUTHENTICATED_FULLY' role ensures that the user has entered his/her credentials (login + password) during this session. If he/she is automatically logged via the 'Remember Me' functionality, he/she won't be able to add a comment. See https://symfony.com/doc/current/cookbook/security/remember_me.html#forcing-the-user-to-re-authenticate-before-accessing-certain-resources #} {% if is_granted('IS_AUTHENTICATED_FULLY') %} {{ render(controller('App\\Controller\\BlogController:commentForm', {'id': post.id})) }} {% else %}

{{ 'action.sign_in'|trans }} {{ 'post.to_publish_a_comment'|trans }}

{% endif %}

{{ 'post.num_comments'|transchoice(post.comments|length) }}

{% for comment in post.comments %}

{{ comment.author.fullName }} {{ 'post.commented_on'|trans }} {# it's not mandatory to set the timezone in localizeddate(). This is done to avoid errors when the 'intl' PHP extension is not available and the application is forced to use the limited "intl polyfill", which only supports UTC and GMT #} {{ comment.publishedAt|localizeddate('medium', 'short', null, 'UTC') }}

{{ comment.content|md2html }}
{% else %}

{{ 'post.no_comments'|trans }}

{% endfor %} {% endblock %} {% block sidebar %} {% if is_granted('edit', post) %}
{{ 'action.edit_post'|trans }}
{% endif %} {# the parent() function includes the contents defined by the parent template ('base.html.twig') for this block ('sidebar'). This is a very convenient way to share common contents in different templates #} {{ parent() }} {{ show_source_code(_self) }} {{ include('blog/_rss.html.twig') }} {% endblock %}