@
Hi all,
We have authored a page and the nodes on the crxde getting created based on the sequence of the authoring. Let's say, I have 3 parsys on page par1 , par2 and par3. If I start authoring with par3 - it will be first node that gets created and then if I author par1 and then par2, then the order of nodes appears in page in JCR is jcr:content
|-par3
|-par1
|-par2
We've created a custom JSON response similar to -1.json which produce the JSON structure based on node order and it's being consumed for the mobile website. Now, the problem here is, since the par3 is being authored at start, it appears as first nodes in JSON however, the since the par3 is at the bottom of page in page component so when we see actual page, it appears at the bottom. But, as the mobile site is being generated based on JSON structure, the bottom content of page(desktop website) appears at the top on mobile website. So, is there any way to display the content in mobile site in similar order as it is on desktop website?
Thanks in advance.
Solved! Go to Solution.
You can add your parsys directly in a template or if you have parsys in components , you can add in cq:template node.
Thats will make sure all 3 parsys nodes will be created as soon as page created and will be maintaining the order.
Never seen a discussion similar to this. I am checking with internal AEM people.
Views
Replies
Total Likes
You can add your parsys directly in a template or if you have parsys in components , you can add in cq:template node.
Thats will make sure all 3 parsys nodes will be created as soon as page created and will be maintaining the order.
I agree with Arun, the easiest work-around is to ensure that the parsys nodes are pre-created when a new page is created by adding the nodes as part of the page template or cq:template if they are included as a component.
Thanks Arun and Gordon for replying. Approaches you guys suggested will work when we create a new pages . Is there a way to fix this issue for the existing pages ? Regards, Vijay.
Views
Replies
Total Likes
You can create a servlet/utility to scan and re arrange nodes.
Not sure if below method would help for nt:unstructured node type Node (Content Repository for Java Technology API Version 2.0)
or you can do with session JCR 1.0: 7.1.7 Moving and Copying (Content Repository for Java Technology API)
I did this experiment:
This means, that in a parsys (or a responsive grid) the order of the components in the JCR and the order in the page are always identical. No matter in what order you created them. Just the order matters. And when you iterate through the child nodes of that "responsivegrid" node using your own code, you will get exactly this order!
Outside of the parsys or responsive grid the situation is different. Here the order typically does not matter, also because an author cannot just drag components into the page, but you as developer / template editor have to add them explicitly. And of course then order is not defined. But your (page) components should know how to deal with that situation, and you should add that logic to your custom JSON exporter too.
(And by the way: If you use the Sling Model Exporter, you can eliminate quite a bit of code ...)
HTH,
Jörg
Views
Replies
Total Likes
Views
Likes
Replies