Alterian ACM : Hiding Pages From The Menu

In most CMS systems I have used, hiding a page from the menu is a pretty simple thing.  After spending over an hour of reverse engineering the ACM assemblies, I finally figured it out, so I thought I would share it with the world.

If you want to have a look yourselves you can use DotPeek to look in the BusinessLayerProviders assembly at the SiteMapProviders class.

      Mediasurface mediasurface = (Mediasurface) HttpContext.Current.Application["Mediasurface"];
SecurityContextHandle securityContextHandle = (SecurityContextHandle) HttpContext.Current.Session["SecurityContext"];
try
{
if (!string.IsNullOrEmpty(this._fieldExcludeNavigationBranch))
{
IIndex[] availableIndexes = item.AvailableIndexes;
string theIndexName = string.Empty;
foreach (IIndex index in availableIndexes)
{
if (index.getName().EndsWith(this._fieldExcludeNavigationBranch))
{
theIndexName = index.getName();
break;
}
}
if (!string.IsNullOrEmpty(theIndexName))
{
ValidIndexValue[] indexValues = item.getIndexValues(theIndexName);
if (indexValues.Length > 0)
return indexValues[0].ValidValue.Equals("yes", StringComparison.OrdinalIgnoreCase);
}
}
}
catch (AuthorizationException ex)
{
}
catch (ResourceException ex)
{
}

From the code I could see I needed to set ‘BranchIndexHideMenu’ which was then used to check that if the index contained the case insensitive value of ‘yes’ it would be ignored from the menu.

Looking at the documentation, it told me the value to use was ‘true’ so that was our first stumbling block.  My next problem was trying to figure out how to create an Index.  Looking in the documentation, I couldn’t see any references in the SiteProvider documentation, so I had to phone the support line up.

So, if you are trying to hide a page in ACM in the Smart Client go to ‘Site Planner’ for your site and right click on the home page, from the menu option select ‘Branch’ then ‘Indexes’.  In here add a new Index called ‘ExcludeFromNavigation’ and add in two new index values ‘yes’ and ‘no’.

To enable the feature in your menus, in your web.config in section add BranchIndexHideMenu=”FromNavigation” job done against your menu entry, job done.

If you’re astute enough, you may be wondering why I’m not using the full index name notice in the code above.  ACM only uses an .EndsWith() on the index name so the full name isn’t actually required….

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

More Posts