{% apply spaceless %}
    {% set description = description|default(globals.site_description) %}

    {% if title is defined %}
        {% set browser_title = title ~ ' :: ' ~ globals.site_name %}
    {% else %}
        {% set browser_title = globals.site_name %}
    {% endif %}

        <title>{{ browser_title }}</title>

        <meta property="og:title" content="{{ title|default(globals.site_name) }}">
        <meta property="og:site_name" content="{{ globals.site_name }}">

    {% if description|length > 0 %}
        <meta name="description" content="{{ description }}">
        <meta property="og:description" content="{{ description }}">
    {% endif %}

        <meta property="og:type" content="object">

    {% if image is defined %}
        {% if image|slice(0, 1) == '/' %}
            {% if globals.site_url is not defined or globals.site_url|length < 1 %}
                {% set image = '' %}
            {% else %}
                {% set image = globals.site_url|trim('/') ~ image %}
            {% endif %}
        {% endif %}

        {% if image|length > 0 %}
            <meta property="og:image" content="{{ image }}">
        {% endif %}
    {% endif %}

    {% if canonical_url is defined %}
        {% if canonical_url|slice(0, 1) == '/' %}
            {% if globals.site_url is not defined or globals.site_url|length < 1 %}
                {% set canonical_url = '' %}
            {% else %}
                {% set canonical_url = globals.site_url|trim('/') ~ canonical_url %}
            {% endif %}
        {% endif %}

        {% if canonical_url|length > 0 %}
            <link rel="canonical" href="{{ canonical_url }}">
            <link rel="og:url" href="{{ canonical_url }}">
        {% endif %}
    {% endif %}

    {% if feeds is defined and feeds is iterable %}
        {% for feed in feeds %}
            <link rel="alternate" type="application/{{ feed.type }}+xml" title="{{ feed.title|default(feed.type) }}" href="{{ feed.url }}">
        {% endfor %}
    {% endif %}
{% endapply %}
