Challenges with placement of page title shape

Topics: General
Nov 2, 2013 at 12:19 PM
I'm having fits trying to get my title placement just right. So far I'm able to address the issue by using URL alternate overrides, but that's not a very scalable solution for a CMS... so reaching out for help.

Here are two problem pages without alternates:
http://www.kerrb.com/blog/welcome-to-the-kerrb-blog
http://www.kerrb.com/contact

You'll notice the title is duped in the gray bar as well as within the content. I don't want to remove the Parts_Title within the placement.info file because it will remove it from both locations. My layout template looks like this:
<div class="titleBox">
  <div class="container">
    <h1 class="big pull-left">@Layout.Title</h1>
    @if (Model.Breadcrumb != null) {
      <div class="pull-right">
        @Zone(Model.Breadcrumb)
      </div>
    }
  </div>
</div>

<div class="container">
  <div class="row-fluid topSpace">
    @if (Model.AsideFirst != null) {
      <div class="span3">
        @Zone(Model.AsideFirst)
      </div>
    }
    @if (Model.Content != null) {
      <div class="@containerClass">
        @Zone(Model.Content)
      </div>
    }
    @if (Model.AsideSecond != null) {
      <div class="span3">
        @Zone(Model.AsideSecond)
      </div>
    }
  </div>
</div>
You can see how it is getting added twice... once within the Layout.cshtml template & once within the Content zone. What I can't figure out is how to remove it from the content zone as I only want it to appear in the gray horizontal bar (the "titleBox" div).

The way I'm addressing this now is with URL alternates (eg: Content-url-about.Detail.cshtml on this page http://www.kerrb.com/about) that simply comment out the Model.Header rendering... but doing that for every single page, especially blog posts, is going to be a nightmare going forward.

Ideas? Feel like I'm missing something easy...
Coordinator
Nov 2, 2013 at 9:05 PM
Are they the same content types? If they are, you can still do something like http://gallery.orchardproject.net/List/Modules/Orchard.Module.Downplay.Orchard.LayoutSelector
Nov 3, 2013 at 12:40 PM
No... there's a mix of content types. Some are the same, others aren't. Was hoping to find a way to clean it up, but another option is to simply have two H1's on the page & only have one filled in. Then in the template, when it loads, use jQuery to hide the inner one on the content part of the page and write the title to the one at the top of the page. Hacky, but I guess it works and will still be SEO friendly.
Coordinator
Nov 4, 2013 at 9:17 AM
Having two h1s on the page, one of which will be empty is definitely not going to be SEO friendly. What's wrong with using layout alternates for each content type, or using a layout selector?
Nov 4, 2013 at 10:42 AM
There isn't anything wrong with it, but I don't see how it will resolve my issue as the root of my problem seems that it can be fixed if I can do one thing: remove the title of the page out of the line in the snippet above that renders the Model.Content. If I can do that, I'm golden. Implementing a layout selector wouldn't help until I can figure out how to remove the title from the rendered Content area of the page.

Does that make more sense?
Coordinator
Nov 4, 2013 at 4:52 PM
Not much, no, I'm afraid. So why don't you just remove that line if you don't want it?
Nov 4, 2013 at 8:02 PM
I don't think I'm explaining my problem well enough :)

I've tried just that, but it doesn't work. I want to have it in the page if you look at the code above that shows this line:
<h1 class="big pull-left">@Layout.Title</h1>
The problem is that it is being rendered in the Model.Content section, specifically in the header. When I remove that, it disappears from BOTH the content area and the line I listed above. If i simply comment it out on a page by page URL override view, that works, but that's the part I said doesn't scale (the process of creating a page, then a overriding view, commenting out the header, and then updating the codebase isn't very CMS-friendly). If I try removing the title part, it goes away from both places. If I try creating a override just for the title part and delete the contents, again, it disappears from both.

For now what I've done is leave the code line above blank and instead, in a title-part override, I've added some code to check if the user agent is a bot and if not, it hides the inner one but writes the title to the line above using jQuery (you can see it from viewing the source here ( http://www.kerrb.com/blog/welcome-to-the-kerrb-blog ) around line 109. Not ideal, but ot the end user it works.

Does that make more sense?
Coordinator
Nov 4, 2013 at 8:11 PM
What doesn't make any sense is that it would disappear from both places. What does your placement file look like?
Nov 4, 2013 at 8:15 PM
No mention of the title part... when I include it and remove it, it disappears from everywhere:
<Placement>

  <Match ContentType="Page">
    <Match DisplayType="Detail">
      <Place Parts_Common_Metadata="-"/>
    </Match>
  </Match>
  
  <!-- remove parts form blog homepage -->
  <Match Path="/blog">
    <Place Parts_Common_Metadata="-" />
    <Place Parts_Feedburner="-" />
  </Match>
  
  <Match ContentType="BlogPost">
    <Match DisplayType="Detail">
      <Place Parts_ListOfComments="-" />
    </Match>
  </Match>
  
  <!-- remove specific parts form specific marketing pages -->
  <Match Path="/">
    <Place Parts_Common_Metadata="-" />
  </Match>
  <Match Path="/pricing">
    <Place Parts_Common_Metadata="-" />
  </Match>
  <Match Path="/about">
    <Place Parts_Common_Metadata="-" />
  </Match>
</Placement>
The other reference I made about overriding specific URL views (like Content-url-about.Detail.cshtml) was when I would comment out this line in the override, it would give me what i wanted just for that page. If i removed this line, it would disappear from the entire page in all places where i reference the title:
@Display(Model.Header)
Now you see what had me confused :)
Coordinator
Nov 5, 2013 at 3:12 AM
The default placement for the title shape is in the Header local zone under Content:
    <Match DisplayType="Detail">
        <Place Parts_Title="Header:5"/>
    </Match>
So yes, if you remove Display(Model.Header) from your content.cshtml template, the title will disappear.

I'm not sure where we're at now.