{% extends "base.html" %}

{% block html_lang %}{{ article.lang }}{% endblock %}

{% block title %}{{ SITENAME }} - {{ article.title|striptags  }}{% endblock %}

{% block head %}
{% if article.status == "hidden" %}
<meta name="robots" content="noindex">
<meta name="robots" content="nofollow">
<meta name="robots" content="noarchive">
{% endif %}

  {{ super() }}
  {% import 'translations.html' as translations with context %}
  {% if translations.entry_hreflang(article) %}
    {{ translations.entry_hreflang(article) }}
  {% endif %}

  {% for tag in article.tags %}
    <meta name="tags" content="{{ tag }}" />
  {% endfor %}
  {% if article.summary %}
  <meta name="description" content="{{ article.summary|striptags }}">
  {% else %}
  <meta name="description" content="{{ article.title|striptags }}">
  {% endif %}

  <!-- Twitter Card Things-->
  {% if article.photo_image %}
  <meta name="twitter:card" content="summary_large_image" />
  {% else %}
  <meta name="twitter:card" content="summary" />
  {% endif %}

  {% if SOCIAL_TWIITER %}
  <meta name="twitter:site" content="@{{ SOCIAL_TWIITER }}" />
  {% endif %}
  <meta property="twitter:domain" content="jeffmackinnon.com">
  {% if article.summary %}
  <meta name="twitter:description" content="{{ article.summary|striptags }}" />
  {% else %}
  <meta name="twitter:description" content="Read the full post at jeffmackinnon.com" />
  {% endif %}
  {% if article.photo_image %}
  <meta name="twitter:image" content="{{ SITEURL }}/{{ article.photo_image[1] }}" />
  {% endif %}

  <!-- Open Graph Tags-->
  <meta property="og:site_name" content="{{ SITENAME }}" />
  <meta property="og:title" content="{{ article.title|striptags  }}" />
  <meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
  <meta property="og:type" content="website">
  {% if article.photo_image %}
  <meta property="og:image" content="{{ SITEURL }}/{{ article.photo_image[1] }}" />
  {% endif %}  
  <meta property="og:description" content="{{ article.summary|striptags }}" />

  {% if COMMENTS is sameas True %}
  <link rel="stylesheet" type="text/css" href="/hashover/themes/default/comments.css"> 
  {% endif %}

  <link rel="canonical" href="{{ SITEURL }}/{{ article.url }}" /> 

{% endblock %}

{% block somemorehead %}
  {% if article.specialcss %}
  <link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css-include/{{ article.specialcss }}">
  {% endif %}

{% endblock somemorehead %}


{% block content %}
  <section id="content" class="body">
    <header>
      <h1 class="entry-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
    </header>
    <div id="entry-info">
      {% import 'translations.html' as translations with context %}
      {{ translations.translations_for(article) }}

      {% if article.authors %}
      <p class="pentry"><address class="vcard author">By {% for author in article.authors %}
        <a class="url fn" href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> 
      {% endfor %}
      </address></p>
      {% endif %}
      <p class="pentry">Published: <time class="published" datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time></p>
      {% if article.modified %}
      <p class="pentry">Updated: <time class="modified" datetime="{{ article.modified.isoformat() }}">{{ article.locale_modified }}</time></p>
      {% endif %}


      {% if SOCIAL_SHARE is sameas true %}
      <p class="share">Share this article on: 
        <span><a class="" href="https://twitter.com/intent/tweet?text={{ article.title|striptags }}&url={{ SITEURL }}/{{ article.url }}{% if SOCIAL_TWITTER %}&via={{ SOCIAL_TWITTER }}{% endif %}" target="_blank" title="Share on Twitter"><i class="fab fa-twitter"></i> Twitter</a></span>
        <span><a class="" href="https://www.linkedin.com/sharing/share-offsite/?url={{ SITEURL }}/{{ article.url }}" target="_blank" title="Share via Linkedin"><i class="icon brands fa-linkedin"></i> Linkedin</a></span>
        <span><a class="" href="mailto:?subject={{ article.title|striptags }}&body={{ article.summary|striptags }} - {{ SITEURL }}/{{ article.url }}" target="_blank" title="Share via Email"><i class="fas fa-envelope"></i> Email</a></span>
      </p>
      {% endif %}
    </div>
    <div class="entry-content">

    {% if article.photo_image and SHOW_TOP_IMAGE == True %}
    <a href="{{ SITEURL }}/{{ article.photo_image[1] }}"><img style="display: block; margin: 0 auto 0 0;" src="{{ SITEURL }}/{{ article.photo_image[1] }}" alt="{{ article.image_alt }}"/></a>
    {% endif %}

    
    {{ article.content }}

    {% if article.photo_gallery %}
    <br /><br />
    {% for title, gallery in article.photo_gallery %}
    <h2>{{ title }}</h2>
        <section class="photo_gallery"> 
        <ol class="photo_gallery">
        {% for name, photo, thumb, exif, caption in gallery %}
          <li class="photo gallery-item"><a href="{{ SITEURL }}/{{ photo }}" target="_blank"  title="{{ name }}" exif="{{ exif }}" caption="{{ caption }}"><img src="{{ SITEURL }}/{{ thumb }}"></a></li>
        {% endfor %}
      </ol></section>
    {% endfor %}
    {% endif %}

    {% if article.series %}
      <div class="post-series">
        <p>This post is part {{ article.series.index }} of the "{{ article.series.name }}" series:</p>
        <ol class="parts">
          {% for part_article in article.series.all %}
          <li {% if part_article == article %}class="active"{% endif %}>
            <a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a>
          </li>
          {% endfor %}
        </ol>      
      </div>
      {% endif %}

      <footer id="post-info">
        {% if article.category %}
        <div class="category">
            <p> In <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a></p>
        </div>
        {% endif %}
        {% if article.tags %}
        <div class="tags">
            Tags:
            {% for tag in article.tags %}
                <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>
            {% endfor %}
        </div>
        {% endif %}
      </footer><!-- /.post-info -->

      {% if COMMENTS is sameas True %}
      <div class="comments">
      <h3>Comments</h3>
      {{ COMMENT_EMBED }}
      </div>
      {% endif %}


      {% if MASTODON_COMMENTS == True and article.mastodon_post_id is defined %}
            <div class="comments">
        <h3>Comment on Mastodon</h3>
        {% include 'include/mastodon-comments.html' %}
      </div>
      {% endif %}

      {% if TWITTER_COMMENTS is sameas True %}
      <div class="comments">
        <h3>Comment on Twitter</h3>
        <p><strong>To join a conversation on Twitter <a href="https://twitter.com/search?q={{ SITEURL }}/{{ article.url }}">click here</a>.</p>
      </div>
      {% endif %}

      
      <section id="article-footer">
        {% if article.photo_image and SHOW_BOTTOM_IMAGE == True %}
        <a href="{{ SITEURL }}/{{ article.photo_image[1] }}"><img style="display: block; margin: 0 auto 0 0;" src="{{ SITEURL }}/{{ article.photo_image[2] }}" /></a>
        {% endif %}
        {% if ARTICLE_FOOTER == true %}
          {% include 'include/article_footer.html' %}
        {% endif %}
      </section>
      

    </div><!-- /.entry-content -->

  </section>
{% endblock %}