{block name='layout-index'}
    {if isset($nFullscreenTemplate) && $nFullscreenTemplate == 1 && isset($cPluginTemplate)}
        {block name='layout-index-plugin-template'}
            {include file=$cPluginTemplate}
        {/block}
    {else}
        {block name='layout-index-include-header'}
            {if !isset($bAjaxRequest) || !$bAjaxRequest}
                {include file='layout/header.tpl'}
            {else}
                {include file='layout/modal_header.tpl'}
            {/if}
        {/block}
        {block name='layout-index-content'}
            {block name='layout-index-heading'}
                {if !empty($Link->getTitle()) && $Link->getLinkType() !== $smarty.const.LINKTYP_STARTSEITE}
                    {opcMountPoint id='opc_before_heading' inContainer=false}
                    <div class="container{if isset($Link) && $Link->getIsFluid() === true}-fluid{/if} index-heading-wrapper">
                        <h1>{$Link->getTitle()}</h1>
                    </div>
                {elseif isset($bAjaxRequest) && $bAjaxRequest}
                    {opcMountPoint id='opc_before_heading' inContainer=false}
                    <div class="container{if isset($Link) && $Link->getIsFluid() === true}-fluid{/if} index-heading-wrapper">
                        <h1>{if !empty($Link->getMetaTitle())}{$Link->getMetaTitle()}{else}{$Link->getName()}{/if}</h1>
                    </div>
                {/if}
            {/block}
            {block name='layout-index-include-extension'}
                {include file='snippets/extension.tpl'}
            {/block}

            {if $Link->getLinkType() === $smarty.const.LINKTYP_STARTSEITE}
                {block name='layout-index-include-index'}
                    {include file='page/index.tpl'}
                {/block}
            {else}
                {et_getSetting section='AreaCms' assign='etCmsSettings'}
                {et_getDevice assign='et_device'}
                {if $Link->getLinkType() !== $smarty.const.LINKTYP_PLUGIN && (!isset($bAjaxRequest) || !$bAjaxRequest) && !empty($etCmsSettings.tocPosition) && ($etCmsSettings.tocPosition === 'left' || $etCmsSettings.tocPosition === 'right') && $et_device === 'desktop'}
                    <div class="container et-toc-container et-toc-position-{$etCmsSettings.tocPosition}">
                        <div class="row">
                            <div class="col-12 col-md-9 col-lg-10" data-no-toc='{ "remove": ["col-md-9", "col-lg-10"] }'>
                                {et_renderGrid id="cms_{$Link->getID()}" fallbackId="cms_main"}
                            </div>
                            <div class="d-none d-md-block col-md-3 col-lg-2 et-toc-col" data-no-toc='{ "remove": ["d-md-block", "col-md-3", "col-lg-2"] }'>
                                {include file="widgets/snippets/table_of_contents.tpl" context="cms" settings=$etCmsSettings}
                            </div>
                        </div>
                    </div>
                {else}
                    {et_renderGrid id="cms_{$Link->getID()}" fallbackId="cms_main"}
                {/if}
            {/if}
        {/block}

        {block name='layout-index-include-footer'}
            {if !isset($bAjaxRequest) || !$bAjaxRequest}
                {include file='layout/footer.tpl'}
            {else}
                {include file='layout/modal_footer.tpl'}
            {/if}
        {/block}
    {/if}
{/block}