Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am very new to umbraco and I wanted to make the parent of my submenus to be static (#) if the doctype used has no template, so far these are what I have done.
if (root != null) { foreach (var child in root.Children) { <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5818 @(Model.Url == child.Url ? "current-menu-item" : null)" style="display: flex; justify-content: space-between"> <a href="@child.Url">@child.Name</a> @if (child.Children.Any() && !child.IsDocumentType("people")) { <button href="#" onclick="toggleChildMenu('[email protected]', this)" style="cursor: pointer; background: none; border: none; padding: 0 1rem; font-size: 1rem; color: rgb(140, 140, 140)"> <i class="fa fa-chevron-down" aria-hidden="true"></i> </button> } </li> if (child.Children.Any() && !child.IsDocumentType("people")) // don't show child nodes of people { <li id="[email protected]" style="border: none; display: none;"> <ul style="margin-left: 1rem; margin-bottom: 0;" class="gdlr-core-custom-menu-widget gdlr-core-menu-style-list"> @foreach (var child2 in child.Children) { <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5818 @(Model.Url == child2.Url ? "current-menu-item" : null)"> <a href="@child2.Url">@child2.Name</a> </li> } </ul> </li> } } } }
Hi strawberrylatte,
You can check whether a node is having template by using this code
​content.TemplateId.HasValue && content.TemplateId > 0
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
set link as static if doc type has no template
I am very new to umbraco and I wanted to make the parent of my submenus to be static (#) if the doctype used has no template, so far these are what I have done.
Hi strawberrylatte,
You can check whether a node is having template by using this code
​content.TemplateId.HasValue && content.TemplateId > 0
is working on a reply...