<!DOCTYPE html>
{% import 'macros.html' as m %}
<html lang="{{ DEFAULT_LANG }}">
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% if (page in hidden_articles) or (page in drafts) or (page in hidden_pages) or (page in draft_pages) %}
            <meta name="robots" content="noindex, nofollow" />
        {% else %}
            <meta name="robots" content="index, follow" />
        {% endif %}
        <title>
            {% block title %}
                Home
            {% endblock title %}
        | {{ SITENAME|e }}</title>
        <meta name="author" content="{{ AUTHOR|e }}" />
        <meta name="generator" content="Pelican v{{ PELICAN_VERSION }}" />
        {% assets filters="libsass,postcss,cssmin", output="css/main.min.css",
            "css/mglass.scss", "css/main.scss", "css/pygments/" + CODE_STYLE + ".css", "css/code.scss" %}
            <link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}" />
        {% endassets %}
        <link rel="stylesheet"
              href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css"
              integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ=="
              crossorigin="anonymous"
              referrerpolicy="no-referrer" />
        <link rel="stylesheet"
              href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css"
              integrity="sha512-+EoPw+Fiwh6eSeRK7zwIKG2MA8i3rV/DGa3tdttQGgWyatG/SkncT53KHQaS5Jh9MNOT3dmFL0FjTY08And/Cw=="
              crossorigin="anonymous"
              referrerpolicy="no-referrer" />
        {% block extra_css %}
        {% endblock extra_css %}
        {% include "analytics.html" %}
        <!-- TODO: move scripts to the bottom of the page, as per Bootstrap canonical example -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
                integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
                crossorigin="anonymous"
                referrerpolicy="no-referrer"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"
                integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg=="
                crossorigin="anonymous"
                referrerpolicy="no-referrer"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"
                integrity="sha512-IsNh5E3eYy3tr/JiX2Yx4vsCujtkhwl7SLqgnwLNgf04Hrt9BT9SXlLlZlWx+OK4ndzAoALhsMNcCmkggjZB1w=="
                crossorigin="anonymous"></script>
        {% assets filters="closure_js", output="js/main.min.js", "js/jquery.mglass.js", "js/application.js" %}
            <script src="{{ SITEURL }}/{{ ASSET_URL }}"></script>
        {% endassets %}
        {% block extra_js %}
        {% endblock extra_js %}
        <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
        <link rel="manifest" href="/site.webmanifest">
        <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
        <meta name="msapplication-TileColor" content="#ffc40d">
        <meta name="theme-color" content="#ffffff">
        <!-- Feeds -->
        {% set all_feeds = [] %}
        {% if FEED_ALL_ATOM %}
            {% if all_feeds.append({'kind': 'Atom', 'url': FEED_ALL_ATOM, 'name': 'All posts'}) %}{% endif %}
        {% endif %}
        {% if FEED_ALL_RSS %}
            {% if all_feeds.append({'kind': 'RSS', 'url': FEED_ALL_RSS, 'name': 'All posts'}) %}{% endif %}
        {% endif %}
        {% if FEED_ATOM %}
            {% if all_feeds.append({'kind': 'Atom', 'url': FEED_ATOM, 'name': 'Latest posts'}) %}{% endif %}
        {% endif %}
        {% if FEED_RSS %}
            {% if all_feeds.append({'kind': 'RSS', 'url': FEED_RSS, 'name': 'Latest posts'}) %}{% endif %}
        {% endif %}
        {% if CATEGORY_FEED_ATOM and category is defined %}
            {% if all_feeds.append({'kind': 'Atom', 'url': CATEGORY_FEED_ATOM.format(slug=category.slug), 'name': 'Category: ' + category.name}) %}
            {% endif %}
        {% endif %}
        {% if CATEGORY_FEED_RSS and category is defined %}
            {% if all_feeds.append({'kind': 'RSS', 'url': CATEGORY_FEED_RSS.format(slug=category.slug), 'name': 'Category: ' + category.name}) %}
            {% endif %}
        {% endif %}
        {% if TAG_FEED_ATOM and tag is defined %}
            {% if all_feeds.append({'kind': 'Atom', 'url': TAG_FEED_ATOM.format(slug=tag.slug), 'name': 'Tag: ' + tag.name}) %}
            {% endif %}
        {% endif %}
        {% if TAG_FEED_RSS and tag is defined %}
            {% if all_feeds.append({'kind': 'RSS', 'url': TAG_FEED_RSS.format(slug=tag.slug), 'name': 'Tag: ' + tag.name}) %}
            {% endif %}
        {% endif %}
        {% for feed in all_feeds %}
            <link href="{{ FEED_DOMAIN }}/{{ feed.url }}"
                  type="application/{{ feed.kind|lower }}+xml"
                  rel="alternate"
                  title="{{ SITENAME|e }} - {{ feed.name|e }} - {{ feed.kind }} Feed" />
        {% endfor %}
        {% block head %}
        {% endblock head %}
    </head>
    <body class="bg-transparent pt-4">
        <div class="container">
            {% if SITE_THUMBNAIL %}
                <a href="{{ SITEURL }}" class="avatar-container float-start mx-4">
                    <div class="avatar {% if SITE_THUMBNAIL_TEXT %}animate{% endif %}">
                        <div class="side">
                            <img src="{{ SITE_THUMBNAIL }}" class="img-fluid" />
                        </div>
                        {% if SITE_THUMBNAIL_TEXT %}
                            <div class="side back position-relative text-center pt-2 px-1 small">
                                <span class="position-absolute top-50 start-0 translate-middle-y">{{ SITE_THUMBNAIL_TEXT }}</span>
                            </div>
                        {% endif %}
                    </div>
                </a>
            {% endif %}
            <h1>
                <a href="{{ SITEURL }}" class="text-body-emphasis text-decoration-none">{{ SITENAME }}</a>
                <small class="text-body-tertiary"><small>{{ SITESUBTITLE }}</small></small>
            </h1>
            <nav class="navbar d-block navbar-expand-lg bg-body-tertiary shadow rounded-3">
                <a class="navbar-brand d-none"
                   href="{{ SITEURL }}"
                   title="{{ SITESUBTITLE|e }}">{{ SITENAME }}</a>
                <button class="navbar-toggler"
                        type="button"
                        data-bs-toggle="collapse"
                        data-bs-target="#plumage-navbar-collapse-1"
                        aria-controls="plumage-navbar-collapse-1"
                        aria-expanded="false"
                        aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse mx-4" id="plumage-navbar-collapse-1">
                    <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                        {% for title, link in MENUITEMS %}
                            {% set active_page = link == ("/%s"|format(output_file)).strip('index.html') -%}
                            <li class="nav-item {% if active_page %}active{% endif %}">
                                <a class="nav-link" href="{{ link }}">
                                    {{ title }}
                                    {% if active_page %}<span class="visually-hidden">(current)</span>{% endif %}
                                </a>
                            </li>
                        {% endfor %}
                        {% if DISPLAY_PAGES_ON_MENU %}
                            {% for p in pages %}
                                {% set active_page = (p == page) -%}
                                <li class="nav-item {% if active_page %}active{% endif %}">
                                    <a class="nav-link" href="{{ SITEURL }}/{{ p.url }}">
                                        {{ p.title }}
                                        {% if active_page %}<span class="visually-hidden">(current)</span>{% endif %}
                                    </a>
                                </li>
                            {% endfor %}
                        {% endif %}
                        {% if DISPLAY_CATEGORIES_ON_MENU %}
                            {% for c, null in categories %}
                                {% set active_category = (c == category) -%}
                                <li class="nav-item {% if active_page %}active{% endif %}">
                                    <a class="nav-link" href="{{ SITEURL }}/{{ c.url }}">
                                        {{ c.name }}
                                        {% if active_category %}<span class="visually-hidden">(current)</span>{% endif %}
                                    </a>
                                </li>
                            {% endfor %}
                        {% endif %}
                    </ul>
                    {% if STORK_SEARCH %}
                        <div class="position-relative dropdown">
                            <div class="input-group">
                                <label class="input-group-text" for="sitesearch-input"><i class="fas fa-search fa-fw"></i></label>
                                <input data-stork="sitesearch" id="sitesearch-input" class="form-control dropdown-toggle" placeholder="Search" data-bs-toggle="dropdown" aria-expanded="false" />
                                <div data-stork="sitesearch-output" class="dropdown-menu dropdown-menu-end shadow"></div>
                            </div>
                        </div>
                    {% endif %}
                </div>
            </nav>
        </div>
        <div class="container mt-5">
            {% set has_left_content = has_left or LEFT_SIDEBAR is defined %}
            {% set has_right_content = has_right or RIGHT_SIDEBAR is defined %}
            <div class="row">
                <div class=" {% if (has_left_content and has_right_content) or LAYOUT == 'full-width' %} col-md-6 {% elif has_left_content or has_right_content %} col-md-9 {% else %} col-md-12 {% endif %} {% if has_left_content %}offset-md-3{% endif %}">
                    {% block top_center %}
                    {% endblock top_center %}
                </div>
            </div>
            <div class="row">
                {% if LAYOUT != 'full-width' and has_left_content %}
                    <div class="col-md-3">
                        {% block left_sidebar %}
                        {% endblock left_sidebar %}
                        {{ LEFT_SIDEBAR }}
                    </div>
                {% endif %}
                <main id="content"
                     role="main"
                     class=" {% if LAYOUT == 'full-width' %} offset-md-1 {% elif has_left_content and has_right_content %} col-md-6 {% elif has_left_content or has_right_content %} col-md-9 {% else %} col-md-12 {% endif %}">
                    {% block content %}{% endblock %}
                </main>
                {% if LAYOUT != 'full-width' and has_right_content %}
                    <div class="col-md-3">
                        {% block right_sidebar %}
                        {% endblock right_sidebar %}
                        {{ RIGHT_SIDEBAR }}
                    </div>
                {% endif %}
            </div>
        </div>
        {# TODO: make footer sticky #}
        <footer class="container-fluid mt-5 p-4 small fw-light">
            <div class="row mx-5">
                {% set SOCIAL_WIDGET_NAME = SOCIAL_WIDGET_NAME or 'Social' %}
                {% set LINKS_WIDGET_NAME = LINKS_WIDGET_NAME or 'Links' %}
                {% for group_title, group_links in ((SOCIAL_WIDGET_NAME, SOCIAL), (LINKS_WIDGET_NAME, LINKS)) %}
                    <div class="col-md-2">
                        {% if group_links %}
                            <h6>{{ group_title }}</h6>
                            <ul class="list-unstyled">
                                {% if MANUAL_LINKS %}
                                    {% for item in group_links %}<li>{{ item }}</li>{% endfor %}
                                {% else %}
                                    {% for title, link in group_links %}<li>{{ m.render_link_icon(link, title, FAVICON_LINKS) }}</li>{% endfor %}
                                {% endif %}
                            </ul>
                        {% endif %}
                    </div>
                {% endfor %}
                <div class="col-md-2">
                    <h6>Browse content by</h6>
                    <ul class="list-unstyled">
                        {% if CATEGORIES_SAVE_AS %}
                            <li>
                                <a href="{{ SITEURL }}/{{ CATEGORIES_SAVE_AS }}">
                                    <i class="bi bi-list-task"></i>
                                    Categories
                                </a>
                            </li>
                        {% endif %}
                        {% if AUTHORS_SAVE_AS %}
                            <li>
                                <a href="{{ SITEURL }}/{{ AUTHORS_SAVE_AS }}">
                                    <i class="bi bi-people-fill"></i>
                                    Authors
                                </a>
                            </li>
                        {% endif %}
                        {% if ARCHIVES_SAVE_AS %}
                            <li>
                                <a href="{{ SITEURL }}/{{ ARCHIVES_SAVE_AS }}">
                                    <i class="bi bi-calendar3"></i>
                                    Dates
                                </a>
                            </li>
                        {% endif %}
                        {% if TAGS_SAVE_AS %}
                            <li>
                                <a href="{{ SITEURL }}/{{ TAGS_SAVE_AS }}">
                                    <i class="bi bi-tags-fill"></i>
                                    Tags
                                </a>
                            </li>
                        {% endif %}
                    </ul>
                </div>
                <div class="col-md-2 text-body-tertiary">
                    <h6>Copyright notice</h6>
                    {% set date_start = dates[-1].date.year if dates else None %}
                    {% set date_end = dates[0].date.year if dates else None %}
                    <p class="small">
                        © Copyright
                        {{ date_start if date_start }}{{ '-%s' % date_end if date_end and date_end != date_start }}
                        {{ AUTHOR }}.
                        {% if COPYRIGHT %}{{ COPYRIGHT }}{% endif %}
                    </p>
                </div>
                <div class="col-md-2 text-body-tertiary">
                    <h6>Disclaimer</h6>
                    <p class="small">
                        {% if DISCLAIMER %}
                            {{ DISCLAIMER }}
                        {% else %}
                            All opinions expressed in this site are my own
                            personal opinions and are not endorsed by, nor
                            do they represent the opinions of my previous,
                            current and future employers or any of its
                            affiliates, partners or customers.
                        {% endif %}
                    </p>
                </div>
                <div class="col-md-2">
                    {% if all_feeds %}
                        <h6>Feeds</h6>
                        <ul class="list-unstyled small">
                            {% for feed in all_feeds %}
                                <li>
                                    <a href="{{ FEED_DOMAIN }}/{{ feed.url }}">
                                        <i class="bi {% if feed.kind == 'RSS' %} bi-rss-fill {% else %} bi-rss {% endif %}"></i>
                                        {{ feed.name }} ({{ feed.kind }})
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
            </div>
            <div class="row mt-3">
                <div class="offset-3 col-6 small text-muted text-center">
                    Site generated by <a class="text-dark" href="https://getpelican.com">Pelican</a>.
                    <br/>
                    <a class="text-dark" href="https://github.com/kdeldycke/plumage">Plumage</a>
                    theme by <a class="text-dark" href="https://kevin.deldycke.com">Kevin Deldycke</a>.
                </div>
                <div class="col-3 text-end d-flex flex-column">
                    <a class="mt-auto" href="#"><i class="bi bi-arrow-bar-up"></i> Back to top</a>
                </div>
            </div>
        </footer>
        {% if STORK_SEARCH %}
            <script src="https://files.stork-search.net/releases/v1.6.0/stork.js"></script>
            <script>
                stork.register("sitesearch", "{{ SITEURL }}/search-index.st")
            </script>
        {% endif %}
    </body>
</html>
