<div class="sidebar-nav">

    <ul class="nav nav-pills nav-stacked">
        {foreach item=Group key=index from=$List.Groups}

            {if $Group != 'Default'}
                <li class="sidebar-nav-head">
                    {assign var='GroupIsActive' value=false}
                    {foreach item=PageListPage from=$List.Pages}
                        {if $PageListPage.GroupName == $Group and $PageListPage.IsCurrent}
                            {assign var='GroupIsActive' value=true}
                        {/if}
                    {/foreach}

                    <span data-toggle="collapse" data-target="#menu{$index}" class="sidebar-nav-item{if not $GroupIsActive} collapsed{/if}">
                        <i class="icon-folder-o"></i>
                        {$Group}
                        <span class="caret"></span>
                    </span>

                    <ul class="nav nav-pills nav-stacked collapse{if $GroupIsActive} in{/if}" id="menu{$index}">
            {/if}
            {foreach item=PageListPage from=$List.Pages}
                {if $PageListPage.GroupName == $Group}

                    {if $PageListPage.BeginNewGroup}
                        <li class="nav-divider"></li>
                    {/if}

                    {if $PageListPage.IsCurrent}
                        <li class="active" title="{$PageListPage.Hint}">
                            <span class="sidebar-nav-item">
                                {$PageListPage.Caption}
                                {if $List.RSSLink}
                                    <a href="{$List.RSSLink}" class="pull-right link-icon">
                                        <i class="icon-rss"></i>
                                    </a>
                                {/if}
                            </span>
                        </li>
                    {else}
                        <li>
                            <a class="sidebar-nav-item" href="{$PageListPage.Href|escapeurl}" title="{$PageListPage.Hint}">
                                {$PageListPage.Caption}
                            </a>
                        </li>
                    {/if}

                {/if}
            {/foreach}
            {if $Group != 'Default'}
                    </ul>
                </li>
            {/if}
        {/foreach}
    </ul>

</div>