In Orchard I have a placement.info file that should hide the Title part when I view an Author:
<Match ContentType="Author">
<Place Parts_Title="-" />
<Place Parts_Breadcrumbs="-" />
</Match>
Author is a custom content type I've created and the Breadcrumbs Part is a custom part.
The breadcrumbs part is hidden, but the title is still displayed. If I inspect it with Shape Tracing it is definitely Parts_Title I want to remove, but the content of my placement file doesn't seem to work.
I do not have a whole of example to go on there, but it seems to me that this part is conflicting with the Parts_Title that ships with orchard.
Try extending the modifier in your placement as well as your shapes to something like:
Parts_MyModule_Title
This just adds some more clarity and can keep orchard from stepping all over itself.
Similar problem here.
This is because your custom part's Placement.info was loaded first and Orchard Title part was loaded after that overriding it.
To solve it, in your custom part's Module.txt, put a dependence on Title. This will force Orchard Title to be loaded first before your custom part.
Related
I have a content type, Events, that has a part "StartDate" that I need to show twice in the summary view. Is it possible inside placement.info to render the part in "this" zone AND "that" zone?
Render the zone twice
Probably not through just using the placement.info file but if you edit the .cshtml view you can just render a zone twice.
For a test I just edited my blog detail view to have this code:
#Display(Model.Content)
#Display(Model.Content)
It worked, and displayed it twice. It's something you should probably be careful with this as in that example it rendered out my Disqus comments twice which created a clash because the same id was used twice on a single page.
Fine tune it with Part Relocation
If you need to pull a single bit of content (a shape/part) out of an existing zone you can also do it with something called Part Relocation which is explained in this Orchard Harvest Session.
The basic idea is to use placement to isolate it into its own zone:
<Match ContentType="News" DisplayType="Detail">
<Place Parts_StartDate="MakeUpAZoneName" />
</Match>
(Note: the Match tag is just an example, its the Place you will need to put in whatever match you want)
And then you can render that out in your .cshtml file with #Display() like:
#Display(Model.MakeUpAZoneName)
... other html code ...
#Display(Model.MakeUpAZoneName)
You can't render same shape twice, but simply you can return combined shapes from your driver and render each shape in different zone.
No its not possible, Only the first one in the file placement.info works.
We would like our Orchard CMS homepage to contain only widgets and no content items. We have two approaches that work:
One. Create a page, title it Home, and set it as the current homepage. Then use placement.info to hide its parts:
<Match Path="/">
<Match ContentType="Page">
<Place Parts_Title="-"/>
<Place Parts_Common_Metadata="-"/>
<Place Parts_Common_Body="-"/>
</Match>
</Match>
This effectively gives us a homepage that displays only widgets. This approach, though, might confuse end users that add content to the site, because they will still see the "Welcome to Orchard!" page and wonder why its content isn't showing up on the site.
Two. Create a new content type called WidgetContainer, that only has the Autoroute part. Then create an instance of it called Home, and set it as the homepage. This is a better approach.
Is there another way to map www.ourdomain.ca to a container that displays only widgets?
Use this module: https://gallery.orchardproject.net/List/Modules/Orchard.Module.Contrib.Widgets
You can create a content type named Widgets Page for instance and add the widgets container part.
I need to modify the existing search module in Orchard such that it displays the Title and Meta Description in the search List.
First of all i added the meta content part to my content types and it is working as i wanted.
Now i don't know how to index Meta content part as there is no option to select the content part in Search Settings. As it is not indexed so when i search on the website Meta content part doesn't appear in shape tracing. As i want to display title, link and meta description in the the search results so i manage to display Title and the link but i don't know how to Meta description in the search result.
Just to play around i added following Meta Parts and content types but its not working
<Place Parts_Meta="Content:2"/>
<Place Parts_Meta_Description="Content:3"/>
<Place Parts_Metas="Content:4"/>
and many more but it seems to be not working.
I think as meta tags are not showing in indexing so may be because of that it is not getting displayed. I don't know exactly how to proceed with it, Please help.!
The search settings does not have Meta Parts or even i can not add it to indexing from the content part.
You don't need to modify the search module for this, just adjust the placement for your content type. The search module displays content items using the "Summary" display type. Use Shape Tracing to find all the properties you need to hide.
So, for example, if your Content Type is called Page then you want this...
<Match ContentType="Page">
<Match DisplayType="Summary">
<Place ...add placement info... />
</Match>
</Match>
I have been attempting to hide the contained items of a Page content type. I have been manipulating the placement.info file in my theme but I am not seeing the results I would expect.
Here's my bruit-force attempt:
<Match Path="/about">
<Match ContentType="Page">
<Match DisplayType="Detail">
<Place Parts_Common_ContentItems="-"/>
<Place Parts_Container_Contained="-"/>
<Place Parts_Container_Contained_Summary="-"/>
<Place Parts_Container_List="-"/>
</Match>
</Match>
</Match>
I have scoured StackOverflow for the answer and I have used the Shape Tracing module to give me direction on designing my placement.info file but I still seem to be missing something.
Any pointers are appreciated!
Thanks.
You cannot hide the content of a container using only Placement.info because the list is rendered by its own controller (Orchard.Core.Containers.Controllers.ItemController) instead of using a shape in the standard orchard shape rendering sytem.
However you may use your own (very simple) controller to build a display without this child list.
I'd say don't put it in the container if you don't want it to appear in there. You might also want to check out taxonomies, that provide a much better and flexible approach to classifying your contents.
I'm trying to change the layout of the admin page for a type and I'm struggling. The client is very specific on the order of the fields and I'm not sure how to do it.
I've created an admin theme and changed the placement.info, but it doesn't seem to work. Are there any hooks I could use to accomplish this?
Any help much appreciated.
My placement.info in the admin theme.
<Match ContentType="Course">
<Place Parts_Routable_Edit="Content:1" />
<Place Fields_Contrib_TaxonomyField_Edit="Content:2" />
<Place Parts_Taxonomies_Term_Fields="Content:2.5" />
<Place Parts_MediaPickerField_Edit="Content:3" />
<Place Parts_Course_Edit="Content:4" />
<Place Parts_Tags_Edit="Content:5" />
</Match>
There's also another problem. I would like 3 taxonomies, and have them placed in different areas of the admin screen. Any idea how to do that?
Since 1.5, you can change the order of parts and fields in the editor, from the admin dashboard. Go to Content Types, select the type, then click on "Manage Placement". You can then drag and drop parts and fields around.
Note that admin themes need to contain a IThemeSelector implementation that gives it a priority of more than 100, which is the priority of the default admin theme.
It really depends on what you want to change. A lot of the admin stuff uses regular ASP MVC, so all you really need to do is override a view or a couple of shapes.
For instance, if you wanted to change how the Modules page was rendered, you could do the following:
Create the folder Views/Orchard.Modules/Admin (this matches the module/controller name) in your theme. Inside it create a view called Index.cshtml, and copy and paste the code from the same view in Orchard.Modules - now you can change your version as much as you like and it should override the default view.
For overriding shapes it is a case of just working out the shape name via the shape tracing module and then adding your own version in your Views folder.
All this is fairly generic advice though, again it really does depend on exactly what you want to change.