{% extends 'RapsysBlogBundle::body.html.twig' %}
{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
{% block blog_subtitle %}<h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2>{% endblock %}
{% block content %}
	{% if article is defined and article %}
	<article id="article">
		<header>
			<h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3>
			<p>
				<span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
				{% if article.keywords %}
					<span>
						{% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %}
						{% for keyword_id, keyword in article.keywords %}
							<a href="{{ path('keywords_keyword', {'_keyword': keyword_id}) }}">{{ keyword }}</a>
						{% endfor %}
					</span>
				{% endif %}
			</p>
		</header>
		<p>{{article.body|bb2html}}</p>
	</article>
	{% endif %}
{% endblock %}
{% block alternate %}
	<link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}" hreflang="{{ app.request.locale }}"/>
	{% for locale, slug in article.slugs %}
		<link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_article': slug}))) }}" hreflang="{{ locale }}"/>
	{% endfor %}
{% endblock %}
{% block footer_nav %}
	<nav>
		{% for locale, slug in article.slugs %}
			<a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_article': slug}))) }}">{{ ('Display in ' ~ locale)|trans }}</a>
		{% endfor %}
	</nav>
{% endblock %}
