<?xml version="1.0"?>
<t name="Blog Posts" t-name="website_blog.blog_post_short">
    <t t-call="website_blog.index">
        <t t-set="head">
            <link t-if="blog" t-att-href="'/blog/%s/feed' % slug(blog)" type="application/atom+xml" rel="alternate" title="Atom Feed"/>
            <meta t-if="active_tag_ids" name="robots" t-attf-content="none"/>
        </t>

        <!-- Check for active options: the stored value may be used in sub-templates too  -->
        <t t-set="opt_blog_cards_design" t-value="is_view_active('website_blog.opt_blog_cards_design')"/>
        <t t-set="opt_blog_list_view" t-value="is_view_active('website_blog.opt_blog_list_view')"/>
        <t t-set="opt_blog_readable" t-value="is_view_active('website_blog.opt_blog_readable')"/>
        <t t-set="opt_blog_sidebar_show" t-value="is_view_active('website_blog.opt_blog_sidebar_show')"/>

        <div id="o_wblog_blog_top">
            <!-- Selectively display droppable-areas for 'all blogs' or single-blog pages -->
            <t t-if="not tag and not date_begin and not search">
                <div id="o_wblog_blog_top_droppable"/>
                <t t-if="blog">
                    <div t-field="blog.content" t-attf-data-editor-sub-message.translate="Edit the '{{blog.name}}' page header."/>
                </t>
                <t t-elif="blogs">
                    <div class="oe_structure" data-editor-sub-message.translate="Edit the 'All Blogs' page header."/>
                </t>
            </t>
            <t t-else="">
                <!-- Droppable-area for filtered results (tags or date) -->
                <div class="oe_structure" id="oe_structure_blog_filtered_header" data-editor-sub-message.translate="Edit the 'Filter Results' page header."/>
            </t>
        </div>

        <t t-call="website_blog.blogs_nav">
            <t t-set="search" t-value="original_search or search"/>
            <t t-set="additional_classes" t-value="'mt-3'"/>
        </t>

        <section id="o_wblog_index_content" t-att-class="opt_blog_cards_design and 'o_wblog_page_cards_bg'">
            <div class="container py-4">
                <div t-if="original_search and posts" class="alert alert-warning mt8">
                    No results found for '<span t-esc="original_search"/>'. Showing results for '<span t-esc="search"/>'.
                </div>
                <div t-attf-class="row #{opt_blog_sidebar_show and 'justify-content-between' or 'justify-content-center'}">
                    <div id="o_wblog_posts_loop_container" t-attf-class="col #{'o_container_small mx-0' if opt_blog_list_view else ''}">

                        <t t-call="website_blog.posts_loop">
                            <t t-if="not blog" t-set="posts_list_show_parent_blog" t-value="True"/>
                        </t>

                        <t t-call="website.pager">
                            <t t-set="classname" t-valuef="justify-content-center"/>
                            <t t-set="extraLinkClass" t-valuef="post_link"/>
                        </t>
                    </div>
                </div>
            </div>
        </section>
    </t>
</t>

