{% extends "base.html" %}

{%- block head -%}{%- set page = page | default(value = section) -%}
{%- set title = "Blog | " ~ page.title -%}
{%- set meta_title = page.title -%}
{%- set meta_image = page.extra.banner_png | safe -%}
{%- set meta_article_type = true -%}
{%- set meta_description = page.extra.summary | default(value = page.content | striptags | safe | linebreaksbr | replace(from = "<br>", to = " ") | replace(from = "  ", to = " ") | trim | truncate(length = 200)) -%}
{%- set css = ["/template/article.css", "/layout/reading-material.css"] -%}
{%- endblock head -%}

{%- block content -%}{%- set page = page | default(value = section) -%}
<section class="reading-material">
	<div class="block">
		<div class="details">
			<h1 class="headline">{{ page.title }}</h1>
			<span class="publication">By {{ page.extra.author }}. {{ page.date | date(format = "%B %d, %Y", timezone="America/Los_Angeles") }}.</span>
			<img class="banner" src="{{ page.extra.banner | safe }}" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" />
		</div>
		<article>
			{{ page.content | safe }}
		</article>
		{% if page.extra.reddit or page.extra.twitter %}
		<hr />
		<div class="social">
			{% if page.extra.reddit %}
			<a href="{{ page.extra.reddit | safe }}" target="_blank" class="button arrow">
				<img src="https://static.graphite.art/icons/reddit__2.svg" /><span>Discuss on Reddit</span>
			</a>
			{% endif %}
			{% if page.extra.twitter %}
			<a href="{{ page.extra.twitter | safe }}" target="_blank" class="button arrow">
				<img src="https://static.graphite.art/icons/twitter.svg" /><span>Twitter</span>
			</a>
			{% endif %}
			{% if page.extra.bluesky %}
			<a href="{{ page.extra.bluesky | safe }}" target="_blank" class="button arrow">
				<img src="https://static.graphite.art/icons/bluesky.svg" /><span>Bluesky</span>
			</a>
			{% endif %}
		</div>
		{% endif %}
	</div>
</section>
{%- if not page.summary -%}
{{ throw(message = "------------------------------------------------------------> ARTICLE HAS NO SUMMARY! After the first paragraph (or two short ones), a `<!-- more -->` comment must be inserted in the markdown. Otherwise the blog page would be missing its preview text." | safe) }}
{%- endif -%}
{%- endblock content -%}

