{% extends "base.html" %}

{% block html_lang %}{{ article.lang }}{% endblock %}

{% block head -%}
{{ super() -}}
{%- if article.summary -%}
	<meta name=description content="{{ article.summary | striptags | safe | truncate(150) }}">
{%- endif -%}
{% endblock %}

{% block title %}{{ article.title | striptags }}{% endblock %}

{% block extra_head %}
{% import 'translations.html' as translations with context %}
{% if translations.entry_hreflang(article) %}
	{{ translations.entry_hreflang(article) }}
{% endif %}
{% endblock %}

{% block content %}
<h1>{{ article.title | markdown }}</h1>
<time datetime="{{ article.date.isoformat() }}" style="font-size: .8em; color: #888;">{{ article.locale_date }}</time>
{%- if article.status != "published" %}
<p style="font-size: .8em; color: #f44;">Not published. This is a {{ article.status }}.</p>
{%- endif %}

<p class=print-only>
<em>
<b>Published:</b> {{ article.locale_date }}<br>
{%- if article.authors %}
<b>Author:</b> {% for author in article.authors %}{{ author }}{% endfor %}<br>
{%- endif %}
</em>
</p>

<p class=print-only>
<em>
Thank you for printing from <a href="{{ PROD_SITEURL }}">sharats.me</a>. Do check back regularly for more such
awesome content. Subscribe at sharats.me/posts/index.xml to stay updated.
</em>
</p>

<article>{{ article.content }}</article>

{%- if article.hn_id or article.reddit_url %}
<p><b>Discuss on</b>:
{%- if article.hn_id %}
	<a target=_blank href="https://news.ycombinator.com/item?id={{ article.hn_id }}">Hacker News</a>
{%- endif %}
{%- if article.hn_id and article.reddit_url %} or {% endif %}
{%- if article.reddit_url %}
	<a target=_blank href="https://www.reddit.com/{{ article.reddit_url }}">Reddit</a>
{%- endif -%}
.</p>
{%- endif %}

{%- endblock %}
