Orchard - Getting the Content's Title from the Theme Layout Orchard - Getting the Content's Title from the Theme Layout asp.net asp.net

Orchard - Getting the Content's Title from the Theme Layout


As a follow up, updates to Orchard since I have asked this question included the ability to use the placement.info file to reroute certain parts to other zones, in effect letting me accomplish what I was looking for.

<Placement>  <Match ContentType="Page">    <Place Parts_Title="/TitleZone"/>  </Match></Placement>


From Layout, Model is the Layout object. It has nothing to do whatsoever with whatever content is going to get rendered into the Content zone, but it does have a Title property that should be set by that content. It is not exactly what you are asking for though: it is what will end-up being the HTML title.

If you want to get to the title of the item that gets rendered into the top-level Content zone, well, Layout is really not a good place to look for that. I would need to know more about what exactly you are trying to achieve but this seems backwards. In fact, you can't even assume that there is one such content item, or that there will be only one.

So what is it exactly that you are trying to do?


Does this work for you?

@Html.Title()

That should work if you're looking for the page title. However, if you're looking to directly access the TitlePart...

@Model.Title

This works because if you look in the Parts.Title template there is a line of code that does this...

@{   Layout.Title = Model.Title;}