【发布时间】:2015-12-03 12:52:35
【问题描述】:
如果侧面导航不包含任何值,我想隐藏它的页眉和页脚。
@inherits UmbracoTemplatePage
<div id="LeftMenuHolder"> @*<----Not show/include these if list is empty*@
<span class="Head-Round-Red"> @*<----Not show/include these if list is empty*@
<span>@CurrentPage.Name</span> @*<----Not show/include these if list is empty*@
</span>@*<----Not show these if list is empty*@
<ul>
@if (CurrentPage.Parent.DocumentTypeAlias == "Home")
{
foreach (var item in CurrentPage.Children.Where("Visible"))
{
<li>
<a href="@item.Url">
<span>@item.Name</span>
</a>
</li>
}
}
else
{
foreach (var sibling in CurrentPage.Parent.Children)
{
<li>
<a href="@sibling.Url">
<span>@sibling.Name</span>
</a>
</li>
}
}
</ul>
<span class="BoxBot"> @*<----Not show/include these if list is empty*@
<span></span> @*<----Not show/include these if list is empty*@
</span> @*<----Not show/include these if list is empty*@
</div>
我确信这可以通过 if 语句来解决,但我不太确定。
【问题讨论】:
-
您的侧边导航是否包含与当前页面“同级”(在同一结构级别)节点的页面?或者它是一种不同的实现方式?
-
@MarkoJ.I 确实包含同级页面