{% extends "base.html" %}

{% block extrahead %}
  {% set title = config.site_name %}
  {% if page and page.meta and page.meta.title %}
    {% set title = title ~ " - " ~ page.meta.title %}
  {% elif page and page.title and not page.is_homepage %}
    {% set title = title ~ " - " ~ page.title | striptags %}
  {% endif %}

  {% if page and page.meta and page.meta.summaryimage %}
    {% set summaryimg = page.meta.summaryimage %}
  {% else %}
    {% set summaryimg = "trent.png" %}
  {% endif %}


  {% if page and page.meta and page.meta.summaryimagew and page.meta.summaryimageh %}
    {% set summaryimgw = page.meta.summaryimagew %}
    {% set summaryimgh = page.meta.summaryimageh %}
  {% else %}
    {% set summaryimgw = 1120 %}
    {% set summaryimgh = 1120 %}
  {% endif %}

  <meta property="og:type" content="website" />
  <meta property="og:title" content="{{ title }}" />
  <meta property="og:description" content="{{ config.site_description }}" />
  <meta property="og:url" content="{{ page.canonical_url }}" />
  <meta property="og:image" content="{{ config.site_url }}photos/{{ summaryimg }}" />
  <meta property="og:image:type" content="image/png" />
  <meta property="og:image:width" content="{{ summaryimgw }}" />
  <meta property="og:image:height" content="{{ summaryimgh }}" />

  <meta name="twitter:card" content="summary_large_image" />
  <meta name="twitter:site" content="@BoringTrent" />
  <meta name="twitter:creator" content="@BoringTrent" />
  <meta name="twitter:title" content="{{ title }}" />
  <meta name="twitter:description" content="{{ config.site_description }}" />
  <meta name="twitter:image" content="{{ config.site_url }}photos/{{ summaryimg }}" />

  <link href="{{ config.site_url }}feed_rss_created.xml" type="application/rss+xml" rel="alternate" title="Trent's Blog - RSS Feed Created"/>
  <link href="{{ config.site_url }}feed_rss_updated.xml" type="application/rss+xml" rel="alternate" title="Trent's Blog - RSS Feed Updated"/>

{% endblock %}


{% block content %}
  {% if page and page.meta and page.meta.title != "Home" %}
    {{ super() }}
  {% else %}
    {% include "home.html" %}
  {% endif %}
{% endblock %}
{% block disqus %}
    {{ super() }}
    {% if page and page.meta and page.meta.post %}
    <script src="https://giscus.app/client.js"
            data-repo="TrentSPalmer/trentsblog_comments"
            data-repo-id="R_kgDOGLitLQ"
            data-category="Announcements"
            data-category-id="DIC_kwDOGLitLc4B_VyZ"
            data-mapping="og:title"
            data-reactions-enabled="1"
            data-emit-metadata="0"
            data-theme="light"
            crossorigin="anonymous"
            async>
    </script>
    {% endif %}
{% endblock %}
