<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {% assign version = page.url | remove_first: "/" | split: "/"" | first %}
    {% if version == nil %}
        {% assign version = site.data.project.default_version %}
    {% endif %}

    {% capture version_home %}/{{ version }}/{% endcapture %}
    {% if page.url == '/' or page.url == version_home %}
        <title>{{ site.data.project.title }} - {{ site.data.project.tagline }}</title>
    {% else %}
        <title>{{ page.title }} - {{ site.data.project.title }}</title>
    {% endif %}

    {% if site.data.project.description %}
        <meta name="description" content="{{ site.data.project.description }}">
    {% endif %}

    {% if site.github.url %}
        <base href="{{ site.github.url }}/{{ version }}/">
    {% else %}
        <base href="/{{ version }}/">
    {% endif %}

    {% if site.data.images.favicon %}
        <link rel="icon" type="image/x-icon" href="{{ site.data.images.favicon }}" />
    {% else %}
        <link rel="icon" type="image/x-icon" href="https://theme.thephpleague.com/img/favicon.ico" />
    {% endif %}

    {% if site.data.images.apple_touch %}
        <link rel="apple-touch-icon-precomposed" href="{{ site.data.images.apple_touch }}">
    {% else %}
        <link rel="apple-touch-icon-precomposed" href="https://theme.thephpleague.com/img/apple-touch-icon-precomposed.png">
    {% endif %}

    <link rel="stylesheet" href="https://theme.thephpleague.com/css/all.css?2">
    <link rel="stylesheet" href="https://glide.thephpleague.com/custom.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
</head>
<body>

<a href="https://github.com/thephpleague/glide" class="github">
    <img src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png">
</a>

<section class="all_packages">
    <a href="http://thephpleague.com/">
        <img src="https://theme.thephpleague.com/img/loep_logo.png" width="195" height="200" alt="The League of Extraordinary Packages">
    </a>
    <h2>Our Packages:</h2>
    <ul>
        <!-- Loaded via JavaScript -->
    </ul>
</section>

<header>
    <a class="logo" href="{% if version == site.data.project.default_version %}/{% else %}/{{ version }}/{% endif %}">
        {% if site.data.images.logo %}
            <span class="icon">
                <img src="{{ site.data.images.logo }}" alt="{{ site.data.project.title }} - {{ site.data.project.tagline }}">
            </span>
        {% endif %}
        <span class="name">{{ site.data.project.title }}</span>
        <span class="tagline">{{ site.data.project.tagline }}</span>
    </a>
    <a href="http://thephpleague.com/" class="league">
        Presented by The League of Extraordinary Packages
    </a>
</header>

<input type="checkbox" id="menu">
<label for="menu" onclick>
    <div class="closed">&#9776; Menu</div>
    <div class="open">&#9776; Hide Menu</div>
</label>

<main>
    <menu>

        <div class="tool">
            <select class="versions">
                {% for v in site.data.menu %}
                    <option data-url="{% if v[0] == site.data.project.default_version %}/{% else %}/{{ v[0] }}/{% endif %}" {% if version == v[0] %}selected="selected"{% endif %}>
                        Version: {{ v[0] }}
                    </option>
                {% endfor %}
            </select>
        </div>

        <div class="tool">
            <input id="search" class="search" placeholder="Search&hellip;">
        </div>

        {% for section in site.data.menu[version] %}
            <h2>{{ section[0] }}</h2>
            <ul>
                {% for link in section[1] %}
                    <li {% if page.url == link[1] %}class="selected"{% endif %}>
                        <a href="{{ link[1] }}">{{ link[0] }}</a>
                    </li>
                {% endfor %}
            </ul>
        {% endfor %}
    </menu>
    <article>
        {{ content }}
    </article>
</main>

<footer>
    <span>&copy; Copyright <a href="http://thephpleague.com">The League of Extraordinary Packages</a>.</span>
    <span>Site design by <a href="http://reinink.ca">Jonathan Reinink</a>.</span>
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://theme.thephpleague.com/js/scripts.js"></script>
<script src="https://glide.thephpleague.com/custom.js"></script>

{% if site.data.project.google_analytics_tracking_id %}
    <script>
        (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
        function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
        e=o.createElement(i);r=o.getElementsByTagName(i)[0];
        e.src='//www.google-analytics.com/analytics.js';
        r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
        ga('create','{{  site.data.project.google_analytics_tracking_id }}');ga('send','pageview');
    </script>
{% endif %}

<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
<script type="text/javascript">
    docsearch({
        apiKey: 'f80ad04b27fad1483c381090747a8be7',
        indexName: 'glide',
        inputSelector: '#search'
    });
</script>

</body>
</html>
