{% extends theme("show.html") %}
{% import theme("blog/utils.html") as blog_utils with context %}
{% import "utils.html" as utils with context %}
{% import "itemviews.html" as itemviews with context %}

{% if blog_item %}
    {% set blog_header = blog_item.content._render_data()|safe %}
    {% set blog_name = blog_item.name %}
    {% set supertags = blog_item.meta['supertags'] %}
{% endif %}

{% if blog_name %}
    {% macro header_search(form) %}
        {{ blog_utils.header_search(blog_name, form) }}
    {% endmacro %}
{% endif %}

{% block theme_stylesheets %}
    {{ super() }}
    <link media="all" rel="stylesheet" href="{{ theme_static('css/blog.css') }}">
{% endblock %}

{% block header_itemviews %}
    {{ itemviews }}
{% endblock %}

{% block content %}
    {% block content_data %}
        <div id="moin-content-data">
            <div id="moin-blog-header">
                {% if blog_header %}
                    {{ blog_header }}
                {% endif %}
            </div>

            <a id="moin-blog-entry-create-link" href="{{ url_for('frontend.new', itemtype='blogentry') }}" >
                <button class="btn btn-primary">{{ _("Create Blog entry") }}</button>
            </a>

            <div id="moin-blog-body">
                <div id="moin-blog-content">
                    {% block blog_content %}<br>{% endblock %}
                </div>
                {% if blog_name and supertags %}
                    <div id="moin-blog-sidebar">
                        {{ blog_utils.widget_supertags(blog_name, supertags) }}
                    </div>
                {% endif %}
            </div>
        </div>
    {% endblock %}
{% endblock %}

{% block footer_itemviews %}
    {{ itemviews }}
{% endblock %}
