{% extends "base.html" %}

{% block content %}
{%- set date_format = macros_translate::translate(key="date_format", default="%B %d, %Y", language_strings=language_strings) -%}
{%- set date_locale = macros_translate::translate(key="date_locale", default="en_US", language_strings=language_strings) -%}

{%- if paginator.pages -%}
	{%- set number_of_posts = paginator.total_pages -%}
{%- elif section.pages -%}
	{%- set number_of_posts = section.pages | length -%}
{%- endif -%}

<h1>{{ section.title }}</h1>

{{ section.content | safe }}

{# <div class="sparkline">
	{%- if paginator.pages -%}
		{%- set pages = paginator.pages -%}
	{%- elif section.pages -%}
		{%- set pages = section.pages -%}
	{%- else -%}
		{%- set pages = term.pages -%}
	{%- endif -%}

	{%- for month, pages in pages | group_by(attribute="month") -%}
		{%- set posts_per_bar = pages | length -%}
		{%- set bar_height = pages | length * 10 -%}
		<div style="--bar-height: {{ bar_height ~ '%' }}" title="{{ macros_translate::translate(key='posts', number=posts_per_bar, default='$NUMBER posts in total', language_strings=language_strings) }}"></div>
	{%- endfor -%}
</div> #}

<p>
	<small>
		{%- if config.taxonomies | length > 0 -%}
			<a href="{{ get_url(path='tags', lang=lang) }}">
				{{ macros_translate::translate(key="filter_by_tag", default="Filter by tag", language_strings=language_strings) }}
			</a>
			<br />
		{%- endif %}
		{{ macros_translate::translate(key="posts", number=number_of_posts, default="$NUMBER posts in total", language_strings=language_strings) }}
	</small>
</p>

{% include "partials/articles.html" %}

{%- if paginator.pages -%}
	<nav id="paginator">
		{%- if paginator.previous -%}
			<a id="paginator-previous" href="{{ paginator.previous }}">
				<i class="icon"></i>
				<div>{{ macros_translate::translate(key='previous', default='Previous', language_strings=language_strings) }}</div>
			</a>
		{%- endif -%}

		<div></div>

		{%- if paginator.next -%}
			<a id="paginator-next" href="{{ paginator.next }}">
				<div>{{ macros_translate::translate(key='next', default='Next', language_strings=language_strings) }}</div>
				<i class="icon"></i>
			</a>
		{%- endif -%}
	</nav>
{%- endif -%}
{% endblock content %}
