{# Basic metadata #}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">

{# Schema #}
<style itemscope itemtype="https://schema.org/WebSite" itemref="schema_name schema_description schema_image"></style>

{# Title #}
<title>{{ site.title }}</title>
<meta id="schema_name" itemprop="name" content="{{ site.title }}">

{# Description #}
{% if site.meta_description is not empty %}
    <meta name="description" content="{{ site.meta_description }}">
    <meta id="schema_description" itemprop="description" content="{{ site.meta_description }}">
{% endif %}

{# Canonical URL #}
<link rel="canonical" href="{{ page.url }}">

{# Author #}
<meta name="author" content="{{ site.title }}">

{# Date #}
<meta name="date" content="{{ page.modified('Y-m-d') }}">

{# Image #}
{% if site.meta_image is not empty %}
    <meta id="schema_image" itemprop="image" content="{{ site.meta_image.toFile.url }}">
{% endif %}

{% if page.template != 'error' %}

    {# Open Graph #}
    <meta property="og:title" content="{{ site.title }}">
    {% if site.meta_description is not empty %}
        <meta property="og:description" content="{{ site.meta_description }}">
    {% endif %}
    {% if site.meta_image is not empty %}
        <meta property="og:image" content="{{ site.meta_image.toFile.crop(1200, 675).url }}">
        <meta property="og:image:width" content="1200">
        <meta property="og:image:height" content="675">
    {% endif %}
    <meta property="og:url" content="{{ page.url }}">
    <meta property="og:type" content="{{ site.og_type }}">

    {# Twitter Card #}
    <meta name="twitter:card" content="{{ site.twitter_card_type.value }}">
    <meta name="twitter:title" content="{{ site.title }}">
    {% if site.meta_description is not empty %}
        <meta name="twitter:description" content="{{ site.meta_description }}">
    {% endif %}
    {% if site.meta_image is not empty %}
        <meta name="twitter:image" content="{{ site.meta_image.toFile.crop(1200, 675).url }}">
    {% endif %}

{% endif %}
