cancel
Showing results for 
Search instead for 
Did you mean: 

Blog and Article post order.

foosetv
Champ in-the-making
Champ in-the-making
I'm running the lastest nightly build of 3.4d and I'm testing out a default Web Quick Start Site and made a few test articles and blog posts. I've noticed on both of them all new posts are showing up in chronological order (oldest first). How do I make them display in reverse chronological order (newest article first)?

In the document library for the news sections, the query field on the metadata for the section.articles folder has the following query:

select d.* from cmis:document as d where in_tree(d, '${section:.}') and d.cmis:objectTypeId='D:ws:article' order by d.cmis:creationDate desc

also respectively in the query field on the metadata for the latest.articles folder in the blog section has the following:

select d.* from cmis:document as d where in_folder(d, '${section:.}') and d.cmis:objectTypeId='D:ws:article' and d.cmis:name not like 'comment-thankyou.html' order by d.cmis:creationDate desc

I'm assuming the part where it says "order by d.cmis:creationDate desc" is the command to display the articles in decending order. I've tried editing this query with no luck. I've tried changing the "desc" to "asc" or leaving it blank, nothing seems to work. Is there some other criteria that articles and blog posts are sorted by that I might be missing?  :cry:
3 REPLIES 3

foosetv
Champ in-the-making
Champ in-the-making
Following up, with some further investigating I'm finding that even if you remove the query completely from any of the articles folders or use any of the folders that are intended to be manually updated, the Web Assets you select will not stay in the order you select. They seem to automatically sort into oldest to the top and newest to the bottom. So as of this moment I can't seem to find a way to have articles or blog post sort in the order of the newest asset on top (as most blogs are formatted) either manually or automatically. I'm currently looking through the Quick Start files to find where to maybe write some code to make this happen. Does anyone have some thoughts?

bremmington
Champ on-the-rise
Champ on-the-rise
Unfortunately this is a weakness of asset collections that we didn't have time to address in this cycle, but we do have on the list for the next one. The problem arises because asset collections reference assets using peer associations that cannot be ordered currently, and there was no suitable alternative that provided both ordering and a user interface in Share to manage the order. We considered a few options to try to resolve this, but none would fit in the available time. I know this is a real problem, and will work on it to get a solution out as soon as possible. It is relatively easy to solve for dynamic asset collections, but harder for static asset collections. Perhaps an initial step that handled the former would still be useful?

In the meantime, the class that returns the asset ids for a given asset collection is AssetCollectionGet (a java-backed webscript). It would be this class that would need to be adjusted to change the way the results are ordered. The only other option would be to order the assets in memory on the web tier. Sorry this isn't ideal. We'll address it as soon as we can.

foosetv
Champ in-the-making
Champ in-the-making
Thank you for your post, it was EXTREMELY helpful. I was able to reverse the order using your suggestion of looking at the AssetCollectionGet class and making a small change. I went into the assetcollection.get.json.ftl file and changed the following lines:
<#list collection.assetIds as assetId>
     "${assetId}"<#if assetId_has_next>,</#if>
</#list>
to add a reverse command to the freemarker tag like so:
<#list collection.assetIds?reverse as assetId>
     "${assetId}"<#if assetId_has_next>,</#if>
</#list>
After a restart of Alfresco, all the quick start pages that display assets are now listing them in reverse chronological order (newest to oldest), much more like how blogs are supposed to be!  Smiley Very Happy

I'll keep this setting until you guys can address the asset order via the query. So far it seems like it should work fine.