Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Content path in pathfield/pathbrowser is not working in AEM Publish although content path valid

Avatar

Level 4

Im authoring the content path in pathfield in my author instance which is a valid content path.
After publishing, in publish instance its not rendering to that html content page after I click the link.
When I observed its due to the .html is not appending in the content path.

  • I don't want to add .html in my component as we have huge number of components to change.
  • I want to handle in AEM itself and I don't want to use apache rewrite url to append .html.
  • I have gone through etc/map but I'm not sure how to use it to perform the .html getting appended in the content path.

Kindly pour in your thoughts. I need some quick fix for this to work.

Thanks

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @samsundar23,

You can do the following to achieve this:
Create a mapping in /etc/map/http of your AEM publish with below node and properties:

tempsnip.png

 

This will ensure it will work with both paths with .html extension and paths without .html extension.

Jineet

View solution in original post

12 Replies

Avatar

Correct answer by
Community Advisor

Hello @samsundar23,

You can do the following to achieve this:
Create a mapping in /etc/map/http of your AEM publish with below node and properties:

tempsnip.png

 

This will ensure it will work with both paths with .html extension and paths without .html extension.

Jineet

Avatar

Level 4

Hi @yjinee94 ,

Thanks for the info.

With or without the html the content is coming up.

 

My requirement is to append .html after moving to the corresponding page on clicking the pathfield link.

For instance, If I have authored /content/xxx-bbb/bunk/about-us in pathfield and 

I should be moving to /content/xxx-bbb/bunk/about-us.html in my publish instance.

 

Is there any way to append .html as well using the etc/map option which you have suggested ?

Please help.

 

Thanks

SHYAMSUNDAR TK

Avatar

Community Advisor
Just wondering, why .html is not getting appended at first place? Generally, OOTB it does. Unless you have specified to 'Strip HTML extension' in 'Day CQ Link Checker Transformer' config.

Avatar

Level 4

Hi @yjinee94,

 

Please find the below screenshot - I checked in both author and publish instance for the below section and nothing is checked in terms of extension less URLs which are coming up.

samsundar23_0-1601541952177.png

 

Thanks

SHYAMSUNDAR TK

 

Avatar

Level 4

Hi @Jineet_Vora 

 

Thanks a lot for all your inputs.

Your recommendations are working for dispatcher pages which has /content in it.

 

Can you provide your recommendation for my dispatcher page if its going to have only short URLs as below;

Any sling:internalRedirect (or) sling:match change which could make it work for the short URLs too.

Kindly help.

 

Thanks

SHYAMSUNDAR TK

Avatar

Community Advisor
Sorry, I don't understand the ask. Do you mean to access your website from dispatcher without .html extension like https://zbank.dev.com/about-us?

Avatar

Level 4

Hi @Jineet_Vora 

 

Your recommendations are spot-on. (Y)

 

I assume there is no /content in the dispatcher URLs which is making it not work.

To be specific there is no common keyword I thought to add in match and internalRedirect to make it work.

Is there any change which i could make in the sling: match or sling: internalRedirect which could make it work generically.

 

My dispatcher URLs are not working.

 

Thanks

SHYAMSUNDAR TK

Avatar

Community Advisor

@samsundar23,

 

I think your dispatcher is already stripping out /content which is creating a conflict mapping it with the rule we have defined on publisher.
For simplicity is it recommended to keep all URL manipulation at one place, meaning: if you are already using dispatcher to strip out base URL path then please use re-write rule on dispatcher only.

Jineet

Avatar

Level 4

Exactly the same problem as you said.
Need some work-around for this issue.

 

Thanks

SHYAMSUNDAR TK

Avatar

Level 4

Hi @Jineet_Vora 

 

Can you explain about these rules which is already in the path

/apps/environment/publisher/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.config

 

  • /content/shared/$1/$3/$4/$2>/guidance/([A-Za-z-]+)/(.+)-(\d{4})(\d{2})
  • /content/shared/([A-Za-z-]+)/(\d{4})/(\d{2})/(.+).html</guidance/$1/$4-$2$3.html

 

When I hit the URL https://publish1.dev.net/content/shared/investing/2018/03/exchange-traded-funds-investor-numbers-inc... 

its redirected to 

https://publish1.dev.net/guidance/investing/exchange-traded-funds-investor-numbers-increase-in-austr...

 

Not sure about the relation between the rule and the redirection happening.

Please help.

 

Thanks
SHYAMSUNDAR TK

Avatar

Level 4

Hi @Jineet_Vora 

 

Apologize to bother you again.

 

I want to append .html at the end of any /content path using resource.resolver.mapping available in the

config (/apps/environment/publisher/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.config)

Any way to do it ? Please help.

 

Thanks

SHYAMSUNDAR TK

Avatar

Level 4

Thanks @Jineet_Vora for all your recommendations.