Display custom text in Branding based on content viewed

Topics: General, Writing themes
Jun 27, 2011 at 12:41 AM

Hi,

I need to show text/info on a header (or better yet, in Branding template), something like a "page lead" or some sort of a page title when user displays a page or a content type. For instance: when home page is displayed I want to show "Home page" text, when blog page or blog post is displayed, I want "News", when products list page or product item page is shown - display "Products" text, and so on... I hope you get the picture.

How to do it in elegant way? I was thinking of possible solutions:

1. create a text field/part with name "SubTitle", add this to Page and other content types. Then in "some place" have: shapeBuilder.Branding().SubTitle = value_read_from_field; and in Layout.cshtml set @Display(Model.Brading) instead of what is current for Branding. But where to put it, where is "some place"?

2. create as many alternates for Branding as required and add them in IShapeTableProvider implemented in theme? I don't like this idea.

3. any other possibilities?

And extra question: where is Model.Title for Document.cshtml set? I couldn't locate in source.

Thanks,

Chris

Coordinator
Jun 27, 2011 at 10:58 PM

A simple text field and some placement.info magic should do the trick with minimal efforts.