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

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:


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.

回答1:

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).



回答2:

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> 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!