{% import theme('_menu.html') as menu with context -%}
<!DOCTYPE html>
<html lang="en">
<head>
    <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 name="description" content="{{Config.get('site', 'site_description')}}">
    <meta name="keywords" content="{{Config.get('site', 'site_keywords')}}">
    <meta name="author" content="{{Config.get('site', 'site_author')}}">
    {% block meta %}{% endblock %}
    {%if content %}
    <link rel="canonical" href="{{content.get_canonical_url()}}"/>
    {% elif channel %}
    <link rel="canonical" href="{{channel.get_canonical_url()}}"/>
    {% endif %}
    <link rel="shortcut icon" href="{{url_for('static', filename='favicon.ico')}}">
    <title>{%block title%}{{Config.get('site', 'site_name', 'Quokka site')}}{% endblock %}</title>
    <link href="{{url_for('static', filename='css/main.css')}}" rel="stylesheet">
    {% block head%}{% endblock %}
</head>
<body>
    {% block navbar %}
    <div class="navbar">
        <div class="logo">
            <a href="/"><img src="{{ Config.get('site', 'site_logo', theme_static('img/logo.png')) }}" alt="{{Config.get('site', 'site_name')}}" /></a>
        </div>
        <ul>
            {% block access_control %}
                <li>
                    {% if current_user.is_authenticated() %}
                        <a href="#">
                        <img src="{{current_user.email | gravatar(size=20) }}" />{{current_user.name}}</a>
                        <ul>
                            <li><a href="{{url_for('admin.index')}}">Admin</a></li>
                            <li><a href="{{url_for_security('change_password')}}">Change password</a></li>
                            <li><a href="{{url_for_security('logout')}}">Logout</a></li>
                        </ul>
                    {% else %}
                        <a href="#">Access</a>
                        <ul>
                            <li><a href="{{url_for_security('register')}}">Register</a></li>
                            <li><a href="{{url_for_security('login')}}">Login</a></li>
                            <li><a href="{{url_for_security('forgot_password')}}">Forgot password</a></li>
                        </ul>
                    {% endif %}
                </li>
            {% endblock %}
        </ul>
    </div>
    {% endblock %}

    <div class="container">
        <div>
            <div>
                {% block breadcrumb %}
                    {% if channel %}
                    <ol>
                        {% if channel != homepage %}
                            <li><a href="/"> {{homepage.title}}</a></li>
                        {% endif %}

                        {%for crumb in channel.get_ancestors()|reverse %}
                            {% if loop.last and not content %}
                                <li>{{crumb.title}}</li>
                            {% else %}
                                <li><a href="{{crumb.get_absolute_url()}}">{{crumb.title}}</a></li>
                            {% endif %}
                        {% endfor %}
                    </ol>
                    {% endif %}
                {% endblock %}
                {% block front %}{% endblock %}
                <div>
                    {% block content %}{% endblock %}
                </div>
            </div>
            <div>
            {% block sidebar %}
                {{ menu.build_nodes(nodes=channels) }}
            {% endblock %}
            </div>
        </div>
        <hr>
        <footer>
            <p>&copy; {{Config.get('site', 'site_name')}}</p>
        </footer>
    </div>
{% block js_footer %}{% endblock %}
</body>
</html>
