<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">

  {% if page.header.metadata.author %}
    {% set author =  page.header.metadata.author %}
  {% elseif page.header.author %}
    {% set author =  page.header.author %}
  {% else %}
    {% set author =  page.header.taxonomy.author[0] %}
  {% endif %}

  {% if author %}
    {% set avatar = author|replace(' ', '-')|lower %}
  {% endif %}

  <header>
    <div class="title">
      {% if page.header.link %}
        <h2 itemprop="headline">
          {% if page.header.continue_link is not sameas(false) %}
            <a href="{{ page.url }}"></a>
          {% endif %}
          <a href="{{ page.header.link }}">{{ page.title }}</a>
        </h2>
      {% else %}
        <h2 itemprop="headline">
          <a href="{{ page.url }}">{{ page.title }}</a>
        </h2>
      {% endif %}
      {% if page.header.subtitle %}
        <p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p>
      {% endif %}
    </div>
    <div class="meta">
      {% if plugin.translate_date.enabled %}
        <time class="published" itemprop="datePublished" datetime="{{ page.date|td(null, "Y-m-d") }}">{{ page.date|td }}</time>
      {% else %}
        <time class="published" itemprop="datePublished" datetime="{{ page.date|date("Y-m-d") }}">{{ page.date|date("M j, Y") }}</time>
      {% endif %}
      {% if author %}
        <a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>
          {% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}"/>
          {% endif %}
        </a>
      {% endif %}
    </div>
  </header>

  {% if page.header.primaryImage %}
    <a href="{{ page.url }}" class="image featured">{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
  {% elseif page.media.images %}
    <a href="{{ page.url }}" class="image featured">{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
  {% endif %}

  <div itemprop="articleBody">
    {% if page.header.continue_link is sameas(false) %}
      {{ page.content|raw }}
      {% if not truncate %}
        {% set show_prev_next = true %}
      {% endif %}
    {% elseif truncate and page.summary != page.content %}
      {{ page.summary|raw }}
    {% elseif truncate %}
      {{ page.content|truncate(550)|raw }}
    {% else %}
      {{ page.content|raw }}
      {% set show_prev_next = true %}
    {% endif %}
  </div>

  <footer>
    <ul class="actions">
      {% if truncate and page.summary != page.content %}
        <li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
      {% elseif truncate %}
        <li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
      {% endif %}

      {% if show_prev_next %}
        {% if not page.isLast %}
          <li>
            <a class="button" href="{{ page.prevSibling.url }}">
              <i class="fa fa-chevron-left"></i>
              {{'FUTURE.BLOG.ITEM.PREV_POST'|t}}</a>
          </li>
        {% endif %}
        {% if not page.isFirst %}
          <li>
            <a class="button" href="{{ page.nextSibling.url }}">{{'FUTURE.BLOG.ITEM.NEXT_POST'|t}}
              <i class="fa fa-chevron-right"></i>
            </a>
          </li>
        {% endif %}
      {% endif %}

    </ul>
    <ul class="stats">
      {% if page.taxonomy.tag %}
        {% for tag in page.taxonomy.tag %}
          <li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
        {% endfor %}
      {% endif %}
      <li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"></a></li>
      <li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook"></a></li>
    </ul>
  </footer>
</article>
