Orchard 1.5 add class or ID in ContentMenuItem

orchardcms

Solution

Go to Content/Content Parts, edit the Menu content part and add a "CssClass" text field. Then, override the template for menuitem.cshtml and right after the `var tag =` line, add:

if (Model.CssClass != null) {
    tag.AddCssClass(Model.ContentItem.Menu.CssClass.Value);
}

That should do the trick.

Problem

How can I add a class and/or ID to be output for a Content Menu Item with Orchard 1.5?

Original source