<title>{% if page_title is defined %}{{ page_title | striptags }} - {% endif %}{{ project.title | localize }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Betty {{ about_version_major }} (https://betty.readthedocs.io)">
{% if project.author %}
    <meta name="author" content="{{ project.author | localize }}">
{% endif %}
<meta name="og:title" content="{{ page_title | default(project.title | localize) | striptags }}">
<meta name="og:site_name" content="{{ project.title | localize }}">
<meta name="twitter:title" content="{{ page_title | default(project.title | localize) | striptags }}">
<meta name="twitter:card" content="summary_large_image">
{% if document.resource %}
    {% if document.resource is has_file_references %}
        {% set page_image_reference = document.resource.file_references | selectattr('file', 'public') | selectattr('file.media_type', 'image_media_type_supported') | first %}
        {% if page_image_reference is defined %}
            {% set page_image = page_image_reference.file %}
            {% set page_image_url = ('betty-static://' ~ page_image_reference | image_resize_cover((500, 500))) | url(absolute=true) %}
            <meta name="og:image" content="{{ page_image_url }}">
            <meta name="og:image:type" content="{{ page_image.media_type }}">
            <meta name="twitter:image" content="{{ page_image_url }}">
            {% if page_image.description %}
                <meta name="og:image:description" content="{{ page_image.description | localize }}">
                <meta name="twitter:image:alt" content="{{ page_image.description | localize }}">
            {% endif %}
        {% endif %}
    {% endif %}
    {% if document.resource_url %}
        <link rel="canonical" href="{{ document.resource_url | url(absolute=true) }}" hreflang="{{ document.localizer.locale | to_language_tag }}" type="text/html">
        {% for locale in project.locales.keys() %}
            {% if locale != document.localizer.locale %}
                <link rel="alternate" href="{{ document.resource_url | url(locale=locale) }}" hreflang="{{ locale | to_language_tag }}" type="text/html">
            {% endif %}
        {% endfor %}
        {% if document.resource is entity_plugin and document.resource is persistent_entity_id %}
            <link rel="alternate" href="{{ document.resource_url | url(media_type='application/json') }}" hreflang="und" type="application/json">
        {% endif %}
    {% endif %}
{% endif %}
{% set icon_url = 'betty-static:///logo.png' | url %}
<link rel="icon" href="{{ icon_url }}">
<link rel="apple-touch-icon" href="{{ icon_url }}">
{% include 'stylesheets.html.j2' %}
