{% set pageTitle = site.name %}

{# We don't want any duplication. This is likely for the home page. #}
{% if site.name === title %}
  {% set pageTitle = title %}
{% endif %}

{% set siteTitle = site.name %}
{% set currentUrl = site.url + page.url %}

{# If the page’s Front Matter has specific metaTitle and/or metaDesc items, switch
  them into the mix. #}
{% if metaTitle %}
  {% set pageTitle = metaTitle %}
{% endif %}

{% if not metaDesc %}
  {% set metaDesc = site.metaDesc %}
{% endif %}

<title>{{ pageTitle }}</title>
<link rel="canonical" href="{{ currentUrl }}"/>

<meta property="og:site_name" content="{{ siteTitle }}"/>
<meta property="og:title" content="{{ pageTitle }}"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="{{ currentUrl }}"/>

{% if not socialImage %}
  {% set socialImage = site.url + '/images/meta/social-share.png' %}
{% endif %}

<meta name="twitter:card" content="summary_large_image"/>
<meta property="og:image" content="{{ socialImage }}"/>
<meta name="twitter:image" content="{{ socialImage }}"/>
<meta property="og:image:alt" content="Page image for {{ site.name }}"/>
<meta name="twitter:image:alt" content="Page image for {{ site.name }}"/>

{% if metaDesc %}
  <meta name="description" content="{{ metaDesc }}"/>
  <meta name="twitter:description" content="{{ metaDesc }}"/>
  <meta property="og:description" content="{{ metaDesc }}"/>
{% endif %}

<link rel="icon" href="/images/meta/favicon.svg" type="image/svg+xml"/>