URL not getting captured properly from pathfield in published url | Community
Skip to main content
Level 4
October 20, 2022
Solved

URL not getting captured properly from pathfield in published url

  • October 20, 2022
  • 2 replies
  • 982 views

Scenario : I have a component which consists of a pathfield. The component has a button, on clicking it it should redirect to the page configured in pathfield in dialog.

 

Issue : I am putting in the URL as /content/project/test-page in the pathfield. The component works fine when I choose "View as published" -- It will automatically attach https://(host)/content/project/test-page.html to the pathfield URL and hence it will work properly.

But in published url it won't add the https://(host) before the url and .html after the url. Hence it's unable to redirect to the page. What exactly is the issue since "view as published" works fine but in published urls it doesn't work.

 

*** I'm using ${properties.buttonPath} to read the pathfield entry. ***

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 Aditya_Chabuku

Hi @arindam6600 ,

 

I think Link Externalizer was not configured properly in your publisher instance. 

Can you try these steps & check again.

  1. Login to the publisher and go to /system/console/configMgr.
  2. search for Link Externalizer and you will this config
     

     

scheme is usually http or https.

server is the host name.

port (optional) is the port number.

 

Try to implement Externalizer in java class via sling model for your component, I'm giving sample code here.

@Reference
 Externalizer externalizer;
 
Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
 
 
 externalizer.publishLink(resolver, "/my/page") + ".html";
 
 externalizer.authorLink(resolver, "/my/page") + ".html";

See this for more details https://github.com/AdobeDocs/experience-manager-64.en/blob/main/help/sites-developing/externalizer.md

 

Hope this helps,

Aditya.Ch

 

 

 

2 replies

Jagadeesh_Prakash
Community Advisor
Community Advisor
October 20, 2022

@arindam6600  Below are some of the reasons and you need to validate from your end

 

1. Check if the selected page is published as well

2. Check if their is any custom URL handler code written in the code

3. In AEMaaCS the dispatcher rules will also be applied on top of the publisher. So make sure if this is caused because of the dispatcher rewrite rules

Aditya_Chabuku
Community Advisor
Aditya_ChabukuCommunity AdvisorAccepted solution
Community Advisor
October 20, 2022

Hi @arindam6600 ,

 

I think Link Externalizer was not configured properly in your publisher instance. 

Can you try these steps & check again.

  1. Login to the publisher and go to /system/console/configMgr.
  2. search for Link Externalizer and you will this config
     

     

scheme is usually http or https.

server is the host name.

port (optional) is the port number.

 

Try to implement Externalizer in java class via sling model for your component, I'm giving sample code here.

@Reference
 Externalizer externalizer;
 
Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
 
 
 externalizer.publishLink(resolver, "/my/page") + ".html";
 
 externalizer.authorLink(resolver, "/my/page") + ".html";

See this for more details https://github.com/AdobeDocs/experience-manager-64.en/blob/main/help/sites-developing/externalizer.md

 

Hope this helps,

Aditya.Ch

 

 

 

Thanks,Aditya Chabuku