Forum
Collection and block template
When I create a collection with a block template it doesn't allow me to sort each entry on title and date. The issue probable is because I use the block template for this, but is there a way to get this done?
What I want to do is make it possible to create different style of posts. For example post 1 will be a standard article. Post 2 will be an image (full with or half with a description), etc.
So basically I want to create post with a different template. (a selection of post types)
How are you trying to sort it?
Tried on "_title, date" and "title, date" and even "heading, date". None work.
Although as I'm typing this I think I know what the problem is.
At the moment each template include has his own Heading and Date to set. I probable need to move this out of each template and set it inside the
<perch:blocks></perch:blocks>
statement.You can't sort on multiple fields, just one.
Which is the best way to do this? Move Heading & Date outside the
<perch:blocks></perch:blocks>
elements?Can you show me the code that's failing?
Sure!
At the moment I still have the following:
posts.html
article.html
image.html
I have tried to move the "heading" and "date" outside the blocks element and that works fine in the overview. Only I need to find to include it in each article element.
What code are you using on your page? That's where the sorting is happening, isn't it?
Don't have yet coded for a page. Currently developing locally and testing what is possible.
The sorting I have done is in Perch itself. At the moment I see item with "Item 1", "Item 2", etc.
I haven't tested this but I think I have to do something like this:
So you're talking about the "Sort By" field in the collection options?
Yeah.
I'm trying to find a balance between posting different style of posts and keep the ability to style them differently. (article, image, quote, etc.)
Ok. Let me know if you have any issues with the real sorting functionality once you have the content on a page.