Hot to get rid of the article tag in my navigation?

Topics: Writing themes
Apr 16, 2013 at 4:10 PM
Hi Guys,

I am trying to style my orchard web site navigation. And I noticed that orchard places and article tag around the nav tag.
<article class="widget-navigation widget-menu-widget widget" shape-id="11">
<nav shape-id="12">
I undertand that if I override the Widget.Wrapper.cshtml I can get rid of this but wouldn't this affect all widgets. I would like to remove the article tag only for the navigation. Is there a way, say using a ShapeTableProvider or a filter (not sure how those work in Orchard at all) that I can dynamically change the navigation markup. I tried this in a ShapeTableProvider class but it does not work:
                .OnDisplaying(displaying =>

                    var navigation = displaying.Shape;

Could be something totally irrelevant?

Any advice will be much appreciated!

Apr 17, 2013 at 3:56 AM
Almost there. I think this is what you actually need to do.

Enable Widget Alternates feature. Create a alternate called Widget-MenuWidget.cshtml in your theme with the following code

I haven't tested this so...I only know it theoretically works in my head. That doesn't always translate to how Orchard works though, unfortunately.
Apr 17, 2013 at 11:26 AM
Hi Haza,

Thanks for the answer! I am not sure if this is going to work because I am looking at the\src\Orchard.Web\Modules\Orchard.Widgets\Views\Widget.Wrapper.cshtml and the article tag is actually applied there:
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
    var widgetPart = ((IContent)Model.ContentItem).As<WidgetPart>();
    var tag = Tag(Model, "article");
    @if ( (widgetPart.RenderTitle && HasText(widgetPart.Title)) || Model.Header != null) {
        @if ((widgetPart.RenderTitle && HasText(widgetPart.Title))) {
    @if(Model.Footer != null) {
I think the only way to remove the article tag is to override this view or to somehow remove the wrapper.
Is there an article or documentation on wrappers, how they are applied and how they can be removed maybe?
I have read the official Orchard docs, really basic to be honest, especially with such a dynamic and complex system.

Apr 17, 2013 at 11:42 AM
It's as Hazza said: create a view for the widget alternate (Widget-MenuWidget.cshtml) and add the mentioned code. That specific code will remove the wrapper shape for MenuWidgets.
Apr 17, 2013 at 12:48 PM
Edited Apr 17, 2013 at 1:01 PM
Yeah, I am with you there buddy, the Orchard documentation is pathetic when it comes to use cases that go beyond the blindingly simple. Especially as the system can literally seem to adapt to do anything...if you know the right snippet of code. I would visit sfmskywalkers blog, he has written an excellent real world example of module building and covers many quirks in Orchard, and Bertrand Le Roys blog, who covers many cool tricks you can do in Orchard. Although to be honest, I'm not sure the internet has space for Orchard docs that cover all the little things Orchard can do

And back on topic...wrappers don't unfortunately support alternates, so you have to use code in a view, sorry!
Apr 17, 2013 at 12:48 PM
Ok, that did it indeed and I almost understand why :-)!
Apr 18, 2013 at 11:29 AM
Back to removing the article tag for widgets, is there a way to do this from code. I want to remove the article tag for a few more widgets, but not for all in the system.
And I do not want to clutter my theme with Widget-widgetname.csthml views just to remove the wrappers from the individual widgets.

Please advise!

May 21, 2013 at 1:21 PM
Hi Millencolin,

Any luck?

May 26, 2013 at 7:12 AM
You can do pretty much anything to a shape from a shape table provider.