Page titles

Topics: Customizing Orchard, General
Feb 27, 2012 at 9:38 PM

I have a site based on Orchard v1.3.

The homepage displays the n latest blog posts on the homepage. The homepage's title is incorrectly set to the title of the title of the nth "latest blog". How do I stop the latest blog posts summary from changing the containing page's title?

I also have several pages that contain lists of other content items. Their page titles appear to be the nth item in the list too! I want the page's title to be the Title of the containing page, not the contained items.

Q: What are the rules around page titles and how do I regain control over the title of pages that contain lists of things?

Thanks in advance.


Feb 28, 2012 at 5:40 AM

Your theme probably incorrectly sets the Layout.Title from one of its templates, very likely a summary template. If it's not a template in the theme, this may be a bug that we fixed in 1.4.

Feb 28, 2012 at 12:33 PM

Have you customised the Content.Summary template?

Basically, the default content template (Content.cshtml) does this:

    if (Model.Title != null) {
        Layout.Title = Model.Title;

And that's how the page title gets pushed up to the top. So there are some possible ways that the Summary view (Content.Summary.cshtml) could start affecting this:

a) You created an override for Content.Summary.cshtml, but copied it from Content.cshtml, so you inherited that code (note: this could be because you installed a 3rd party theme which made this mistake)

b) You're actually displaying an item from the blog list in "Detail" view

c) You're using a completely custom display type instead of Summary


Feb 28, 2012 at 11:32 PM

Thanks for the info guys - I took your suggestions and modified my theme to omit setting the Layout.Title when rendering content type summaries. Worked a treat :)