Expand my Community achievements bar.

SOLVED

Pagefield is not adding .html extension to internal URLs in QA instances

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.



Arun Patidar

View solution in original post

10 Replies

Avatar

Community Advisor

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 



Arun Patidar

Avatar

Level 3

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?

Avatar

Community Advisor

Hi @manasabojja7 
Yes, you should check the config.

Can you also share the crxde content node where values are stored from pagefield?



Arun Patidar

Avatar

Level 3

The below is the node for the URL field, /apps/<appName>/components/ComponentA

 

manasabojja7_0-1699977626528.png

Here's the content node where this is being referred:

The below is the node for the URL field, /apps/<appName>/components/ComponentA

 

manasabojja7_0-1699977626528.png

Here's the content node where this is being referred:

 

manasabojja7_2-1699977914221.png

 

 

Avatar

Community Advisor

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.



Arun Patidar

Avatar

Level 3

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?

Avatar

Correct answer by
Community Advisor

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.



Arun Patidar

Avatar

Community Advisor

Hi @manasabojja7 

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

Avatar

Level 3

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.

Avatar

Administrator

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



Kautuk Sahni