{% macro content(page, summary) %}
    {%- if summary and page.summary %}
    <div class="post">
        <div class="post_contents">
            {{ page.summary | safe }}
        </div>
    </div>
    <div class="read_more">
        <a class="button_read_more" href="{{ page.permalink | safe }}">
            <span class="button_text">Read More</span>
        </a>
    </div>
    <br>
    <hr>
    {% else %}
        <div class="post">
            <div class="post_contents">
                {{ page.content | safe }}
            </div>
        </div>
    {% endif -%}
{% endmacro content %}

{% macro header(page) %}
<h1 class="post_title"><a class="post_link" href="{{ page.permalink | safe }}">{{ page.title }}</a></h1>
<div class="post_meta">
    {{ post::date(page=page) }}
    {{ post::tags(page=page) }}
</div>
{% endmacro header %}

{% macro date(page) %}
    <span class="post_date">
        {%- if page.date %}
            {{ page.date | date(format="%Y-%m-%d") }}
        {% endif -%}
    </span>
{% endmacro post_date %}

{% macro postview(page) %}
    {%- if config.extra.enable_postview %}
    <div class="pagination">
        <div class="pagination_title">
            <span class="postview_title_text">{{ config.extra.postview_prompt }}</span>
        </div>
            <hr>
        <div class="pagination_buttons">
            {%- if page.later %}
                <span class="pag_button previous">
                    <a class="pagination_link" href="{{ page.later.permalink | safe }}">
                        <span class="button_text"><span class="arial">&#8656;</span>  {{ page.later.title }}</span>
                    </a>
                </span>
            {% endif %}
            {%- if page.earlier %}
                <span class="pag_button next">
                    <a class="pagination_link" href="{{ page.earlier.permalink | safe }}">
                        <span class="button_text">{{ page.earlier.title }}  <span class="arial">&#8658;</span></span>
                    </a>
                </span>
            {% endif -%} 
        </div>
    </div>
{% endif -%}
{% endmacro postview %}

{% macro tags(page) %}
{%- if page.taxonomies and page.taxonomies.tags %}
    <span class="post_tags_inline">
        |
        {%- for tag in page.taxonomies.tags %}
            <a class="post_tag" href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">::{{ tag }}</a>
            {%- if not loop.last %}&nbsp;{% endif -%}
        {% endfor -%}
    </span>
{% endif -%}
{% endmacro tags %}

{% macro list(pages) %}
<ul class="post_list">
    {%- for page in pages %}
        {%- if page.draft %}
            {% continue %}
        {% endif -%}
        <li class="post_list_item">
            <a class="post_list_link" href="{{ page.permalink | safe }}">
                <span class="post_date">{{ page.date }}</span><span class="post_list_title"> :: {{ page.title }}</span>
            </a>
        </li>
    {% endfor -%}
</ul>
{% endmacro list %}
