Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

html extension for page links

Avatar

Level 7

hi ,

 

I supertyped List component and created a new component with new option "Custom List".

 

Out of the box "fixed list" links have ".html" extension, where as custom option, model I created does not generate ".html" extension.

 

Question: what is the best way to generate .html extension (Is it using Externalizer ? but it doesn't seem to generate .html extension )

 

NOTE:

I have some external URLs such as https://somesite.com/financial-information/quarterly-results

which should not get .html extension but only pages /content/myaemsite pages should get .html extension

 

Do I need to write any linktransformer implementation and rewriter osgi config ?

 

I tried to look into https://github.com/adobe/aem-core-wcm-components/blob/d3d89a177d9a5095a648484a1b00d2046e73ce27/bundl...

to see how aem core components doing but could not get to the bottom of it.

 

 

Screenshot 2023-02-02 085436.pngScreenshot 2023-02-02 091313.pngScreenshot 2023-02-02 091218.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Yes, you can go with transformer and rewriter config approach if you think the LinkBuilder Implementation is not working for your use-case. 

 

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @sreenu539,

 

Please check this class & method in WCM Core module - https://github.com/adobe/aem-core-wcm-components/blob/d3d89a177d9a5095a648484a1b00d2046e73ce27/bundl... 

 

You can use the LinkBuilder implementation to generate the link with html extension.  

Avatar

Level 7

I have some external URLs such as https://somesite.com/financial-information/quarterly-results

which should not get .html extension but only pages /content/myaemsite pages should get .html extension

 

 

Avatar

Level 7

Do I need to write any linktransformer implementation and rewriter osgi config ?

Avatar

Correct answer by
Community Advisor

Yes, you can go with transformer and rewriter config approach if you think the LinkBuilder Implementation is not working for your use-case. 

 

 

 

Avatar

Community Advisor

If you check lines #146 && #147 in the LinkBuilderImpl class, the code checks if it is a page in AEM, then attempts to resolve the link and adds the HTML extension. In the case of external URLs, I believe it returns the link without any extension, but you could test it quickly to confirm it suites your case.