primavera133
primavera133

Reputation: 1314

CQ QueryBuilder orderby component order within a page

I'm trying, in Adobe CQ 5.6.1, to build a menu listing components added to a page. These components will have an id and I will anchor-link to these so the page will scroll down to them respectively.

The problem is i get them in scrambled order.

If I laborate in the query builder and with the local Geometrixx site (so you can follow, if you have a local instance of CQ running) this would be an example of a similar query, picking images and text components from the products page:

http://localhost:4502/libs/cq/search/content/querydebug.html?charset=UTF-8&query=type%3Dnt%3Aunstructured%0D%0Apath%3D%2Fcontent%2Fgeometrixx%2Fen%2Fproducts%2Fjcr%3Acontent%0D%0Aproperty%3Dsling%3AresourceType%0D%0Aproperty.1_value%3Dfoundation%2Fcomponents%2Fimage%0D%0Aproperty.2_value%3Dfoundation%2Fcomponents%2Ftext%0D%0Aorderby%3D%40jcr%3AlastModified%0D%0Aorderby.sort%3Dasc

I'm not at all interested in ordering them by jcr:lastModified, I want the order they are presented on the page.

Does anyone have any idea what to order by?

Upvotes: 2

Views: 1383

Answers (1)

bongman1612
bongman1612

Reputation: 440

Following on from your comment, iterating over the components seems to be the easiest way.

Assuming you have the id stored as a property, on successive iteration of each component node, you would seek to extract this id and store it into a list.

This would ensure the order as you require, and you can then display the id as links.

Upvotes: 2

Related Questions