Expand my Community achievements bar.

SOLVED

URL not getting captured properly from pathfield in published url

Avatar

Level 5

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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
     

     

    link_externalizer.png

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

 

Hope this helps,

Aditya.Ch

 

 

 

Thanks,

Aditya Chabuku

View solution in original post

2 Replies

Avatar

Community Advisor

@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

Avatar

Correct answer by
Community Advisor

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
     

     

    link_externalizer.png

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

 

Hope this helps,

Aditya.Ch

 

 

 

Thanks,

Aditya Chabuku