Page title and date modified?

Topics: Customizing Orchard, General
Feb 16, 2011 at 9:28 PM

By default the Page Title and Date-time of last modification get injected into the body of the page, at least when using the default TheThemeMachine.

Where is this occurring and how do I disable it?

Coordinator
Feb 16, 2011 at 11:18 PM

The title is injected as shape Parts_RoutableTitle by the RoutePartDriver in Core/Routable. The date is injected as part of Parts_Common_Metadata by the CommonPartDriver in Core/Common.

You can suppress the display of each shape from your placement.info file by placing each of the shapes in the "-" black hole zone.

Feb 17, 2011 at 12:11 AM

Thank you Bertrend. I also discovered I could do it in my theme's site.css file as follows:

/* Hide the page title (in body) and date published */
.content-item header  h1 {display:none;}
.content-item .metadata .published {display:none;}

I like the idea of using the placementinfo file better, so I looked at: http://www.orchardproject.net/docs/Anatomy-of-a-theme.ashx

which states "A theme can modify where shapes are rendered by including a placement.info file at the root of the theme's folder."

I tried placing the following in the root of my theme but it did not work:

<Placement>
    <!-- available display shapes -->
    <!--
    Parts_RoutableTitle
    Parts_RoutableTitle_Summary
    Parts_RoutableTitle_SummaryAdmin
    -->
    <Place Parts_Routable_Edit="Content:before.5"/>
    <Match DisplayType="Detail">
        <Place Parts_RoutableTitle="Header:-"/>
    </Match>
    <Match DisplayType="Summary">
        <Place Parts_RoutableTitle_Summary="Header:-"/>
    </Match>
</Placement>

 

What did I do wrong?

Coordinator
Feb 17, 2011 at 12:40 AM

You do not want to send markup to the browser that you are not going to display. CSS is entirely the wrong way of doing that except if that markup is going to have some hidden function on the client side.

Try this:

<Placement>
    <Match DisplayType="Detail">
        <Place Parts_RoutableTitle="-"/>
    </Match>
    <Match DisplayType="Summary">
        <Place Parts_RoutableTitle="-"/>
    </Match>
</Placement>

Feb 17, 2011 at 1:05 AM

That did the trick. I totally agree that CSS is not the best way to go.

I think I need to go to the bookstore and purchase "Orchard for Dummies" ;-)

Feb 17, 2011 at 11:10 PM

Guys, this is just what i was looking for also. thanks

would actually be a nice setting to include from the admin section as well, as the date/time info will not be desired for a lot of pages.. it is more useful in a blog post etc. 

Feb 25, 2011 at 4:33 AM

How can I find out the display shapes so I now what I can throw away?

Coordinator
Feb 25, 2011 at 4:36 AM

You can look at what parts you have on your content type and track down the drivers (that's where those shapes are getting created. In Orchard 1.1, we are shipping a tool that shows you all the shapes that are being displayed and what alternates are available for them.

Feb 25, 2011 at 4:44 AM

So the placement.info file goes in the root of the theme, correct? If I follow your earlier example, that hides the title and not the date.

Coordinator
Feb 25, 2011 at 4:51 AM

The date is in another shape:

Parts_Common_Metadata

Feb 25, 2011 at 5:00 AM

That worked. Can't wait for 1.1 to get that tool. Guess I won't bother looking into building something for it.

So, my Placement file looks like this:

<Placement>
    <Match ContentType="Page">
        <Match DisplayType="Summary">
            <Place Parts_Common_Metadata="-"/>
        </Match>
        <Match DisplayType="Detail">
            <Place Parts_Common_Metadata="-"/>  
        </Match>
    </Match>
</Placement>

I am singling out the Page, because I don't want to hide the date from other elements like Blog posts. I would like to remove it from the Blog "Page". How can I do that?

Coordinator
Feb 25, 2011 at 5:04 AM

ContentType="Blog"?

Jan 18, 2013 at 4:24 PM

Ok, I to am trying to use this technique and its not working. I want to hide the Title and Date from all pages including the Home Page. I am using the Theme Machine, can anyone help me?

Jan 18, 2013 at 5:24 PM

Specifically, I'm trying to remove it from the home page.

Coordinator
Jan 18, 2013 at 6:21 PM

Show exactly what you tried and tell us how it failed.

Jan 18, 2013 at 8:42 PM

I tried:

<Placement>
    <Match Content="Page">
    <Match DisplayType="Detail">
        <Place Parts_RoutableTitle="-"/>
    </Match>
    <Match DisplayType="Summary">
        <Place Parts_RoutableTitle="-"/>
    </Match>
    </Match>
</Placement>

Jan 18, 2013 at 8:54 PM

What Orchard version are you running on?

Jan 18, 2013 at 8:58 PM

1.6

Coordinator
Jan 18, 2013 at 8:59 PM

Where did you put the file?

Jan 18, 2013 at 9:07 PM

placement.info under the theme folder

Jan 18, 2013 at 9:19 PM

If memory serves me right, wasn't the Parts_RoutableTitle shape generated by the RoutablePart, which was deprecated since 1.4?

Jan 18, 2013 at 9:20 PM

Ok, how can I remove the Title and Date from Page Headers? Any ideas?

Jan 19, 2013 at 12:23 AM

<Place Parts_Title="-" />
<Place Parts_Common_Metadata="-"/>

no?

Coordinator
Jan 19, 2013 at 4:39 AM

Good catch.

Jan 20, 2013 at 2:53 PM

Thank you, that worked.

Jan 20, 2013 at 2:57 PM

I have another question. If I want to make a whole zone, such as Content Zone not show up for a given page, anyone have an idea on how to achieve this?

Jan 20, 2013 at 3:16 PM

Do you mean the "global" Content zone on the Layout shape, or the "local" Content zone on a content item shape?

Jan 20, 2013 at 5:45 PM

I don't think there is a way to hide an entire zone. Just hide the separate components via the placement file. 

Jan 20, 2013 at 6:00 PM

Hiding global zones could be done by overriding the Layout template.

Check this out
http://weblogs.asp.net/bleroy/archive/2011/01/10/orchard-shapeshifting.aspx
http://weblogs.asp.net/bleroy/archive/2011/06/06/getting-started-with-custom-themes-in-orchard.aspx

 

Feb 18, 2013 at 7:20 PM
Ok, so I want to remove the Title and Date off all pages except the Blog and Blog post page. I use this to remove the Title and Date globally:
<Match Content="Page">
<Match DisplayType="Detail">
    <Place Parts_Title="-" />
    <Place Parts_Common_Metadata="-"/>
</Match>
</Match>
But that removes it from the Blog pages also, how to achieve this?
Feb 18, 2013 at 11:44 PM
On the first line, try changing the "Content" attribute to "ContentType".
Feb 19, 2013 at 12:11 AM
That worked. Thanks a lot my friend.

Regards,
Tommy Havens