Hi Team,
I'm using cq/gui/components/coral/common/form/pagefield for any link refs to be authored. It is adding .html to internal URLs and not adding the .html to external URLs. All this is working fine in my local instance but when this change is deployed to QA, it does not add the extension of .html to internal URLs as well.
Tried using this as well granite/ui/components/coral/foundation/form/pathfield but this doesn't add extension at all even in local instance.
Are there any configuration changes that need to be enabled/disabled on the QA instance? Or is there any other resource type that we should be using for Link fields that differentiate the internal and external URLs?
Any help is appreciated.
Thanks,
Manasa
Solved! Go to Solution.
Views
Replies
Total Likes
You should check org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl or /etc/map or link rewrite can be found at /apps/yourprojrct/config
It maybe possible that In your local, the link transformer maybe activated by another project.
Try with vanilla instance and your project code.
Hi @manasabojja7
PathField does not add extension automatically,
you might have rewrite configuration that adds html after the path.
Please org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl config, where it is working. You might be missing configs
https://abhigyanswaroop.medium.com/resource-mapping-in-adobe-experience-manager-aem-1658653a683
Thanks @arunpatidar for the response.
Using cq/gui/components/coral/common/form/pagefield resourceType is adding .html automatically. Do you mean that the config might be on the local instance for PageField?
Hi @manasabojja7
Yes, you should check the config.
Can you also share the crxde content node where values are stored from pagefield?
The below is the node for the URL field, /apps/<appName>/components/ComponentA
Here's the content node where this is being referred:
The below is the node for the URL field, /apps/<appName>/components/ComponentA
Here's the content node where this is being referred:
Hi @manasabojja7
You can see that the cardLinkUrl property in the last screenshot, which contain aem page link without html.
That means you have configuration somewhere to append .html to those link.
Hi @arunpatidar
Yeah, that is the same node structure in my local instance too. It adds .html perfectly fine in Local but not on actual QA, and Stage instances. Regarding the config that you were talking about, can you let me know which exact attribute in the config should I be validating between Local and QA to understand the difference in behavior?
You should check org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl or /etc/map or link rewrite can be found at /apps/yourprojrct/config
It maybe possible that In your local, the link transformer maybe activated by another project.
Try with vanilla instance and your project code.
This can also be achieved by adding the below logic in your component
<sly data-sly-test.linkCheck="${links.linkPath}"></sly>
<div data-sly-test.internalLink="${'/content/' in linkCheck}"><a href="${links.linkPath}.html"
target="${links.linksTarget}"><span> ${links.linkTitle} </span></a></div>
Otherwise read the value of the field within the SlingModel and return the final value adding .html in the url from the backend logic itself.
Hope this helps!
Thanks
Thanks for your response @ShaileshBassi
I'm mostly looking to see if it can be done without this additional logic.
Using the cq/gui/components/coral/common/form/pagefield resourceType seems to work fine for both internal (adding .html) and external (not adding the extension) on my local instance but fails to behave the same in the QA instance.
@manasabojja7 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies