London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
How are you rendering your Menu?
If you're using the EPiServer:MenuList Web Control you can add EnableVisibleInMenu="false" to include pages that have visible in menu set to false.
Yes, it's really depends on how you are rendering the menu.
If you are constructing it manually, you can use filters and properties (this could be useful found in Alloy MVC sample):
public static IEnumerable<T> FilterForDisplay<T>(this IEnumerable<T> contents, bool requirePageTemplate = false, bool requireVisibleInMenu = false)
where T : IContent
{
var accessFilter = new FilterAccess();
var publishedFilter = new FilterPublished(ServiceLocator.Current.GetInstance<IContentRepository>());
contents = contents.Where(x => !publishedFilter.ShouldFilter(x) && !accessFilter.ShouldFilter(x));
if (requirePageTemplate)
{
var templateFilter = ServiceLocator.Current.GetInstance<FilterTemplate>();
templateFilter.TemplateTypeCategories = TemplateTypeCategories.Page;
contents = contents.Where(x => !templateFilter.ShouldFilter(x));
}
if (requireVisibleInMenu)
{
contents = contents.Where(x => VisibleInMenu(x));
}
return contents;
}
private static bool VisibleInMenu(IContent content)
{
var page = content as PageData;
if (page == null)
{
return true;
}
return page.VisibleInMenu;
}
If you mean the web control <EPiServer:PageTree />
Try to add EnableVisibleInMenu="false"
How can I show a page in menu programmatically while it is set to false(visible in menu) in settings of edit mode?