{block name='blog-index'}
    {block name='blog-index-include-header'}
        {include file='layout/header.tpl'}
    {/block}
    {block name='blog-index-content'}
        {if JTL\Shop::$AktuelleSeite === 'NEWSDETAIL'}
            {block name='blog-index-include-details'}
                {include file='blog/details.tpl'}
            {/block}
        {else}
            {et_hasGrid id="newscategory_main" assign="newsCategoryMainGridExists"}
            {block name='blog-index-overview'}
                {if isset($Link) && $Link->getID() > 0 && $Link->getLinkType() === $smarty.const.LINKTYP_NEWS}
                    {* Moved outside of blog/overview.tpl to allow widgets between heading and cms content *}
                    <div class="container{if isset($Link) && $Link->getIsFluid() === true}-fluid{/if} et-blog-title-heading">
                        {block name='blog-overview-heading'}
                            {opcMountPoint id='opc_before_heading'}
                            <h1 class="et-blog-title">{if !empty($Link->getTitle())}{$Link->getTitle()}{else}{lang key='news' section='news'}{/if}</h1>
                        {/block}
                    </div>
                    {if empty($oNewsCat) || (!$oNewsCat->getID() > 0) || !$newsCategoryMainGridExists}
                        {* Load CMS Area Grid for News/Blog Posts, cms_content.tpl includes the blog/overview.tpl *}
                        {et_renderGrid id="cms_{$Link->getID()}" fallbackId="cms_main"}
                    {else}
                        {et_renderGrid id="newscategory_{$oNewsCat->getID()}" fallbackId="newscategory_main"}
                    {/if}
                {else}
                    {if $newsCategoryMainGridExists}
                        {if empty($oNewsCat) || (!$oNewsCat->getID() > 0)}
                            {et_renderGrid id="newscategory_main"}
                        {else}
                            {et_renderGrid id="newscategory_{$oNewsCat->getID()}" fallbackId="newscategory_main"}
                        {/if}
                    {else}
                        <div class="container{if isset($Link) && $Link->getIsFluid() === true}-fluid{/if}">
                            {* Fallback to the default behavior if there is no news category main grid existing *}
                            {include file="blog/overview.tpl"}
                        </div>
                    {/if}
                {/if}
            {/block}
        {/if}
    {/block}

    {block name='blog-index-include-footer'}
        {include file='layout/footer.tpl'}
    {/block}
{/block}
