This project is read-only.

Title only projection

Topics: Customizing Orchard
Jan 26, 2014 at 3:26 PM
Edited Jan 26, 2014 at 3:47 PM
I am working my way through Orchard trying to understand concepts and making a website as I go along. I am stuck on doing a simple thing - creating a title/link-only projection.
My query is on Content Type Blog Post. However I always get the full summary in my sidebar layout. It seems like I should be able to change this in Layouts but so far nothing has worked.

If this is not possible in setting up the query through the website, I was hoping to change it in my file. Again I can't see how that works. If I use <Match ContentType="Blog"> for placement I only want to affect the summary when it is in a right sidebar. I see that can tell content to go into zones, but not how to use <Place Parts_Tags_ShowTags="-"/>(etc) in a particular zone.

The third option is to create a new template through the Shape Tracer alternates. I can get that to work but from what I have read, it seems there ought to be a less code-oriented solution.

Thanks again for everyone's work on Orchard. It is great!
Jan 26, 2014 at 9:38 PM
You can use placement info like this: <Match ContentType="BlogPost" DisplayType="Summary"> <Place PartShape1="-" /> <Place PartShape2="-" /> ... </Match> replace PartShape1 and others with names of shapes or other parts than TitlePart, so that only title
part is displayed. You can use shape tracing to find which shapes are displayed per blog post in your projection. Placement info can tell shapes from content part and field drivers to be placed in local zones, that is the zones from Content.cshtml, or not
rendered at all using the special dash zone. It works regardless of the global zone (side bar, featured, triple first or content zone, zones from Layout.chstml of the active theme, the zone you use when you place widgets) the content is displayed.
Jan 27, 2014 at 4:38 AM
Thanks, I will try it out.
Just curious, is this the right solution for a title-only link list? Is there a different way other than a projection? It seems like such a common requirement.
I could always use css to hide pieces of the output - but that would be delivering code to the browser that won't be ever seen.
Jan 27, 2014 at 9:26 AM
A projection is the way to go that provides extensible querying and formatting. For very common scenarios, there are specialized container content types, like Blog and RecentBlogPosts for BlogPosts and Menu for MenuItems, which don't necessarily use projections,
but I'm not aware of a generic title link list solution. You can do this however, which is a cleaner solution: When creating/editing the query, create an HTML layout, select Properties instead of Content for Displat Mode of the layout, click add a property,
select Title property of Title Part, or Display Text property of the Content group of properties.On the edit properties page check Link to content item. This way you don't change at all, since the part driver is not called but some binding is
used to provide the text to display. There are many formatting and grouping options which I don't know how to use. I guess you can find some detailed explanations and examples in DOJO course videos.
Jan 29, 2014 at 12:51 AM
I got the idea for the solution to this by watching the dojo course Advanced content management... on projections.
A standard query works, then instead of bringing it into a projection, one brings it into a menu as a querylink. That gets set into a sidebar widget - Voila a title only list. Not exactly intuitive but couldn't be easier one one knows the trick. Thanks