Expand my Community achievements bar.

SOLVED

Switch foundation parsys to Sighly parsys

Avatar

Level 4

I want to switch from the old foundation parsys to the Sightly parsys without having to update the existing content we have.

I first tried the ACS Commons Delegating Servlet:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig" prop.target-resource-type="wcm/foundation/components/parsys" sling.servlet.extensions="html" sling.servlet.methods="GET" sling.servlet.resourceTypes="foundation/components/parsys" sling.servlet.selectors=""/>

But this doesn't work.

Then I tried adding an overlay directly in the JCR 

/apps/foundation/component/parsys

This works but I need to copy the all the code in to it (from wcm/foundation/components/parsys). I can't use the sling:superResourceType as wcm/foundation/components/parsys.

1 Accepted Solution

Avatar

Correct answer by
Employee

This is the only thing you need to do in your code..

<div data-sly-resource="${ 'par' @ resourceType='wcm/foundation/components/parsys'}"></div>

Now the 'new' resourceType will be used to render the 'par' node. This way you can use multiple components to render a node.

If you don't specify a resourceType, the sling:resourceType of the node will be used.

Hope this helps.

View solution in original post

10 Replies

Avatar

Level 10

Where did you get this idea or a suggestion that this is a valid use case - an online article? That is - to modify the ACS Commons Delegating Servlet.

I asked our Eng team to look at this one. 

Avatar

Level 8

So, from experience i can tell you this - you really don't need to do anything other than add "wcm/" in front of the include.  The problem that you will run in to is that with the Sightly parsys, it no longer wraps any components in a div element with the class name of the component you added (i.e. if you added a textimage component to one of the old parsys elements, it would wrap everything in <div class="textimage"></div>).  That no longer happens with the Sightly parsys so if your CSS is targeting those wrappers you'll run into a lot of issues.

Avatar

Employee

To me this doesn't look like a good idea going forward.

Is there a specific reason why you want to switch?

Avatar

Level 4

We only have 30 components, so I was going to add a cq:htmlTag (DIV) to each component to counter the change before we start migrating each to Sightly over a period of 3-4 months whilst adding newer Sightly-only components.

I am more worried about updating throusands of pages/nodes adding wcm/ (I know this can be done using a File/Replace in Files).

Avatar

Level 4

Its was going to be temporary measure so it doesn't immediately break our websites when we change the template to use the Sightly parsys. I am exploring strategies how we can start migrating to using Sightly for all of our components.

I know the Sightly parsys is not required to display Sightly and non-Sightly components but it has advantages, removing the redundant DIV element whilst still being able to edit the component.

-

I am looking for a transition strategy so that our three current websites using the old foundation parsys can continue to work with the new sightly parsys without updating every page / sub jcr:content node with the new parsys reference.

Avatar

Level 8

I have no idea what your project structure is, but if you only have 30 components, i can only image you have less page templates.  I would simply go into each file and add the "wcm/" to the start of anywhere that includes a parsys.  You don't need to go update any nodes or anything in the JCR, everything just seems to work.  

Avatar

Level 4

Updating templates is fine. We only have 3 page templates, but each parsys node under jcr:content for each website page has the resourceType on it as well which needs updating - this is over 3000 pages. This is the update I am trying to avoid.

Avatar

Level 8

I think you're missing my point.  You don't need to go update the nodes in the JCR.  Just change the parsys' in your components to "wcm/" and don't worry about the JCR.  Your components will all still work.

Avatar

Level 4

I got you now - but will the existing pages point to the old foundation parsys - or the new Sightly one? They will remain pointing to the old one, no?

Avatar

Correct answer by
Employee

This is the only thing you need to do in your code..

<div data-sly-resource="${ 'par' @ resourceType='wcm/foundation/components/parsys'}"></div>

Now the 'new' resourceType will be used to render the 'par' node. This way you can use multiple components to render a node.

If you don't specify a resourceType, the sling:resourceType of the node will be used.

Hope this helps.