how to inspect runtime view hierarchy

Topics: Writing themes
Jan 11, 2014 at 10:19 PM
Edited Jan 11, 2014 at 10:24 PM
I have only recently started with Orchard, and am still running into some basic obstacles. I quickly discovered that developing a customized theme is the most optimal approach for my website, as I need to emit custom HTML all over the place.

One of the things that I am constantly struggling with is not being able to identify where final markup is coming from. With plain MVC, the structure is usually traceable through .cshtml hierarchy, as one view will render another child view or call a controller action or something like that, which is all pretty easy to follow.

With Orchard, there are extra levels of indirection hidden from the developer, which means that I constantly have to guess as to where a piece of output is originating from, or why don't I see a change in the output even though I modified what appears to be the relevant view for the scenario.

My recourse often ends up picking some keyword from HTML or even Razor code and doing a textual search of all modules/themes that are available to my website. This is clearly not how it's supposed to be done, because even though it works, it's very unproductive and ad-hoc.

Is there a more structured way to inspect runtime view hierarchy? Maybe some kind of tracer or a page debugger module. Or am I addressing the problem from a completely wrong direction to begin with?
Jan 11, 2014 at 11:07 PM
Shape Tracing module is what you are looking for.

Marked as answer by unbelievable on 1/11/2014 at 4:38 PM
Jan 11, 2014 at 11:50 PM
This is great. This module will help a lot, not just with this problem, but much more.

Feb 5, 2014 at 8:52 PM
The ShapeTracing feature is a great help in many scenarios, but I can't find any information e.g. on why a certain view was used to render my shape and not an override that I've defined in my module.

Am I missing something? This is what I put in my new module:


The green views do override the Content.Edit.cshtml view from Orchard.Core\Contents\Views, the red one with exactly the same name does not.

What am I doing wrong?