Switch foundation parsys to Sighly parsys | Community
Skip to main content
New Participant
October 16, 2015
Solved

Switch foundation parsys to Sighly parsys

  • October 16, 2015
  • 10 replies
  • 4158 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

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.

10 replies

smacdonald2008
New Participant
October 16, 2015

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. 

New Participant
October 16, 2015

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.

Feike_Visser1
Employee
October 16, 2015

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

Is there a specific reason why you want to switch?

New Participant
October 16, 2015

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).

New Participant
October 16, 2015

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.

New Participant
October 16, 2015

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.  

New Participant
October 16, 2015

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.

New Participant
October 16, 2015

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.

New Participant
October 16, 2015

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?

Feike_Visser1
Feike_Visser1Accepted solution
Employee
October 16, 2015

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.