This project is read-only.

Page title override

Topics: Customizing Orchard, General
Jun 22, 2016 at 6:04 PM
Howdy Orchard friends,

I'm wondering if anybody has any pointers on how to override the page title of the web document.

Currently in my Document.cshtml there's the default:
<title>@Html.Title(siteName, title)</title>
I want to create an optional Title Override part for some content types that, if filled in, would override the default one. Something like:

        string titleOverride = Model.ContentItem.MetadataPart.MetaTitleOverride.Value;
        if (titleOverride != null) {
            <title>@Html.Title(siteName, titleOverride)</title>
        } else {
            <title>@Html.Title(siteName, title)</title>
But the above doesn't work, even after creating that Meta Title Override field on the my MetadataPart part.

Do I maybe need this outside my Document.cshtml? I appreciate any suggestions.
Jun 23, 2016 at 3:19 PM
You may try this HelperMethod. I think that should work:
And of course the standard
@Layout.Title = "bla"