{% load static %}
{% load i18n %}
{% load pyaa_http %}
{% load pyaa_vite %}
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- Meta Tags -->
<meta name="description" content="{% if page_description %}{{ page_description }}{% else %}{% translate 'site.description' %}{% endif %}">
<meta name="keywords" content="{% if page_keywords %}{{ page_keywords }}{% else %}{% translate 'site.keywords' %}{% endif %}">
<meta name="author" content="{% if page_author %}{{ page_author }}{% else %}{% translate 'site.author' %}{% endif %}">

<!-- Title -->
<title>{% if page_title %}{{ page_title }}{% else %}{% translate 'site.name' %}{% endif %}</title>

<!-- Open Graph Meta Tags -->
<meta property="og:title" content="{% if page_title %}{{ page_title }}{% else %}{% translate 'site.name' %}{% endif %}">
<meta property="og:description" content="{% if page_description %}{{ page_description }}{% else %}{% translate 'site.description' %}{% endif %}">
<meta property="og:type" content="{% if page_og_type %}{{ page_og_type }}{% else %}website{% endif %}">
<meta property="og:url" content="{% if page_url %}{{ page_url|force_https }}{% else %}{{ request.build_absolute_uri|force_https }}{% endif %}">
<meta property="og:image" content="{% if page_og_image %}{{ page_og_image|force_https }}{% else %}https://{{ request.get_host }}/static/images/logo-og.png{% endif %}">
<meta property="og:image:width" content="{% if page_og_image_width %}{{ page_og_image_width }}{% else %}512{% endif %}">
<meta property="og:image:height" content="{% if page_og_image_height %}{{ page_og_image_height }}{% else %}512{% endif %}">
<meta property="og:locale" content="{% if page_og_locale %}{{ page_og_locale }}{% else %}en{% endif %}">
<meta property="og:site_name" content="{% translate 'site.name' %}">

<!-- Twitter Meta Tags -->
<meta property="twitter:card" content="{% if page_twitter_card %}{{ page_twitter_card }}{% else %}summary{% endif %}">
<meta property="twitter:site" content="{% if page_twitter_site %}{{ page_twitter_site|force_https }}{% else %}{{ request.build_absolute_uri|force_https }}{% endif %}">

<!-- Apple Meta Tags -->
<meta name="apple-mobile-web-app-title" content="{% if page_title %}{{ page_title }}{% else %}{% translate 'site.name' %}{% endif %}">
<meta name="application-name" content="{% if page_title %}{{ page_title }}{% else %}{% translate 'site.name' %}{% endif %}">

<!-- Canonical URL -->
<link rel="canonical" href="{% if page_url %}{{ page_url|force_https }}{% else %}{{ request.build_absolute_uri|force_https }}{% endif %}">

<!-- Theme -->
<script>
    (function() {
        var theme = localStorage.getItem('theme');
        if (theme) {
            document.documentElement.setAttribute('data-theme', theme);
        } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
            document.documentElement.setAttribute('data-theme', 'black');
        }
    })();
</script>

<!-- Assets -->
{% vite_all_css %}
{% vite_all_js %}

<!-- Web Manifest -->
<link rel="manifest" href="{% static 'site.webmanifest' %}">
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" href="{% static 'images/favicon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicon-16x16.png' %}">
<link rel="shortcut icon" href="{% static 'images/favicon.ico' %}" type="image/x-icon">
<meta name="msapplication-TileColor" content="#000000">
<meta name="theme-color" content="#000000">

{% include "partials/google_analytics.html" %}
