Orchard CMS - Remove Title and Metadata(published date) in a post
Asked Answered
A

2

18


How do I remove the Title and Metadata(published data) in a post? Can this be done in Placement.info? I tried creating a custom content but doesn't look like a best solution. I just done it with CSS but I know this could be done in another way.

Arsenide answered 19/3, 2012 at 13:4 Comment(0)
H
29

You can edit the Placement.info file in your current theme's root folder to not display the title and publish date:

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

See this post for further details: Orchard: Anatomy of a theme

Also, in case you are wondering where names like Parts_Title come from, see Customizing Orchard using the Designer Helper Tools (specifically shape tracing).

Horme answered 19/3, 2012 at 13:16 Comment(6)
great info! Parts_RoutableTitle didn't work so I tried Parts_Title and the title was gone. I think because I made a custom content.Arsenide
Thanks for the update, I'll update the answer too to reflect this.Horme
Right I have another question. what about doing the same thing from different Content Type? e.g. I have 2 different Content Types and both has Title. I want to show the Title for the 1st Content Type and the 2nd not.Arsenide
Sorry - I got it. I used ContentType instead of DisplayTypeArsenide
Wow, thanks @Horme that saved my day! (week). The Shape Alternate module now also comes great in place. Totally new, but after reading the docs.orchardproject.net/Documentation/… I can easily overwrite Core shapes to my Theme and customize them.Thimble
In my case I just wanted to remove the title from the home page... <Match Path="/"> <Place Parts_Title="-"/> </Match>Stove
L
15

Alternatively, if you want to keep the title meta in the head whilst removing the title on every page create a Parts.Title.cshtml file in the view folder of your theme and then put

@{
Layout.Title = Model.Title;
}

which is exactly the same as the normal code except we remove the <h1> tag

@{
Layout.Title = Model.Title;
}

<h1>@Model.Title</h1>
Laetitia answered 23/7, 2012 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.