Get published nodes/pages in the order they were published
I'm currently struggling with this and I can't seem to find documentation on it either.
I have a couple of unpublished articles on my site that I keep for editing, future publishing etc. The thing is that I want to order them on my site in the time they were published.
I currently use this line of code: var selection = CurrentPage.Site().FirstChild("news").Children("articles").Where("Visible").OrderBy("CreateDate desc");
As you can see. They're ordered by the date they were created. However. I would like to order them by the date/time they were published.
Get published nodes/pages in the order they were published
I'm currently struggling with this and I can't seem to find documentation on it either.
I have a couple of unpublished articles on my site that I keep for editing, future publishing etc. The thing is that I want to order them on my site in the time they were published.
I currently use this line of code:
var selection = CurrentPage.Site().FirstChild("news").Children("articles").Where("Visible").OrderBy("CreateDate desc");
As you can see. They're ordered by the date they were created. However. I would like to order them by the date/time they were published.
Use UpdateDate instead of CreateDate but note that if you / users update the content then the UpdateDate will be the last datetime of publish.
I'd suggest that you add a Date Time picker to your article which allows the user to set a publish date for display / sorting.
There's a discussion here: http://stackoverflow.com/questions/20940740/umbraco-7-how-do-i-get-the-published-date-from-ipublishedcontent
I figured that's what I had to do. Thx for your answer :)
is working on a reply...