{% macro header(page) %}
<h1 class="post-title"><a href="{{ page.permalink | replace(from=config.base_url, to="") }}">{{ page.title }}</a></h1>
<div class="post-meta-inline">
    <span class="post-date">
        {%- if page.date %}{{ page.date | date(format="%Y-%m-%d") }}{% endif %}
    </span>
</div>
{{ self::tags(page=page) }}
{% endmacro header %}

{% macro content(page, summary, show_only_description) %}
{%- if show_only_description %}
    <div class="post-content">{{ page.description | safe }}</div>
{% elif summary and page.summary %}
    <div class="post-content">{{ page.summary | safe }}</div>
    <div>
        <a class="read-more button" href="{{ page.permalink | replace(from=config.base_url, to="") }}">
            <span class="button__text">read more</span>&nbsp;
            <span class="button__icon">&#8617;&#xFE0E;</span>
        </a>
    </div>
{% else %}
    <div class="post-content">{{ page.content | safe }}</div>
{%- endif %}
{% endmacro content %}

{% macro tags(page, short=false) %}
{%- if page.taxonomies and page.taxonomies.tags %}
    <span class="post-tags-inline">
        {%- if short %}:: {% set sep = "," %}
        {% else %}:: tags:&nbsp;{% set sep = "&nbsp;" %}
        {% endif %}
        {%- for tag in page.taxonomies.tags | sort %}
            <a class="post-tag" href="{{ get_taxonomy_url(kind='tags', name=tag) | replace(from=config.base_url, to="") }}">#{{ tag }}</a>
            {%- if not loop.last %}{{ sep | safe }}{% endif %}
        {%- endfor %}
    </span>
{% endif %}
{% endmacro tags %}
