Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Adding Title to Pages in All Themes #6718


User avatar
0
martin created

We are attempting to add a HTML title to all the Index pages when they are loaded.

So in all the _Layout.cshtml pages for the Default, Theme11 .... the code

@section Title{
    @RenderSection("Title", true)
}

was added, then for each Index.html page the code

@section Title{
    @L("Settings")
}

was added which works correctly.

We are having an issue with Theme8 which has a _Layout.cshtml page with a different layout. So I get an exception since it finds a title in an Index page which shouldn't be there (because it isn't picking up the boolean switch).

Is this the correct way to achieve this ? Or is there a better method for added a title to each Index.html page ?


4 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    What shouldn't be there? What boolean switch?

  • User Avatar
    0
    martin created

    To get a custom HTML Title to any index page I need to add RenderSection("Title", true) to the _Layout.cshtml pages. And then Title to the Index.cshtml pages.

    If I don't add RenderSection("Title", true) to the _Layout.cshtml page it give me nice exception error.

    We got all the pages loading except the Theme8 _Layout.cshtml page is a LOT different to the others and we can't work out where to add RenderSection("Title", true)

    So my question is either where do we add the RenderSection("Title", true) to the Theme8 _Layout.cshtml page, OR are we doing something we shouldn't and the framework handles custom titles and we just need to update the framework code ?

  • User Avatar
    0
    maliming created
    Support Team

    I don't understand why you don't use ViewBag?

  • User Avatar
    1
    martin created

    Again thanks for the keyword @maliming ! You guys are awesome so glad we bought this framework !

    I will do some more research, keep in mind my knowledge is limited in some regards. On the plus side we are getting in a part time contractor to assist us with the more complicated problems.