Orchard query by blog post content type

Topics: Administration, Customizing Orchard
Feb 26, 2014 at 10:58 AM
Edited Feb 26, 2014 at 12:46 PM
Hi there

I have created a query which returns all blog post content types and then sorts the results descending.

This works however where we have edited one particular blog 3 times it is showing as 3 separate blog posts rather than 1. Is there a way of returning the latest version of this blog please? Something along the lines of a distinct query if I was writing the SQL.

I have tried deleting a blog post but deleted posts are still included in the query results but when I go to 'manage blog' they are not visible!

Any help would be much appreciated,

Many thanks in advance,

Feb 26, 2014 at 5:45 PM
I can't reproduce the problem. Do you mean that every time you made a change to your blog post Orchard creates a new post?
That is weird.

Anyway, if you want to "hide" posts in your queries you can simply unpublish them, and they will no appear.

Feb 27, 2014 at 8:18 AM

Thanks Matias, I have tried unpublishing them and they still show in the query!

Is there a way to filter on whether something is published or unpublished?

Tx Kirsty

Feb 27, 2014 at 5:24 PM
First of all, maybe we have different versions of Orchard installed. I can't reproduce the issues you describe. Do you have 1.7.2 installed?

I can't find a way to filter on published. But I tried the following and it seems to work.
  • Edit Blog Post Content Type. Add a new boolean field. Call it something like "DisplayInQueries".
  • Edit your query. Add a new filter. Now you should have a new group of filters , "Blog Post Content Fields". Use the the filter: DisplayInQueries:Value.
Then you simply need to edit your blog post and check the displayInQueries checkbox on the posts you want to show.
I don't know if it is the "right way" to do it but I tested and it works for me.

Mar 3, 2014 at 9:17 AM

Hi again Matias,

Thanks for your reply. I have checked and I am using Orchard v.

I followed your steps for adding in a Boolean field and this worked brilliantly. Thanks so much.

For some reason once I had checked the field for each query I then published each one again.

Now on all my query results on the website all the dates are showing as today 03/03/3014 rather than the created date.

Do you know a way round this? Today’s date would be the modified date not the created date.

Thanks again,