diff --git a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml index 9aea94f15..c0aa8f271 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml +++ b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml @@ -28,16 +28,16 @@ : null; IHtmlString sectionHeaderMarkup; - if (firstLevelMenuItem.RouteValues != null || HasText(firstLevelMenuItem.Url)) { - sectionHeaderMarkup = HasText(itemId) - ? Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName, id = itemId }) - : Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName }); - } - else if (firstOfTheSecond != null && firstLevelMenuItem.LinkToFirstChild && (firstOfTheSecond.RouteValues != null || HasText(firstOfTheSecond.Url))) { + if (firstOfTheSecond != null && firstLevelMenuItem.LinkToFirstChild && (firstOfTheSecond.RouteValues != null || HasText(firstOfTheSecond.Url))) { sectionHeaderMarkup = HasText(itemId) ? Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName, id = itemId }) : Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName }); } + else if (firstLevelMenuItem.RouteValues != null || HasText(firstLevelMenuItem.Url)) { + sectionHeaderMarkup = HasText(itemId) + ? Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName, id = itemId }) + : Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName }); + } else { // if the header isn't linked and there are no children there's no reason for this item in the menu other than to look pretty if (secondLevelMenuItems.Count() == 0) {