I have a website where the site structure is /content/mysite/us/en/page.html.
I have the following sling mapping set up so the site can be served without /content/ in the path at https://example.com/mysite/us/en/page.html:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:mixinTypes="[cq:ReplicationStatus,sling:MappingSpec]"
jcr:primaryType="nt:folder"
sling:internalRedirect="[/content/mysite/$1/$2/$3]"
sling:match="mysite/([a-z]{2})/([a-z]{2})/(.*)"/>
The problem is, when I view the site without the /content/ path in the URL, all the links on the page still contain /content/ in them. How do I implement the feature so that /content/ is automatically removed from all link element attributes when the URL does not contain /content/ in it?
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
You need to write a service to process the links based on whatever the criteria you want.
Now in each of the component/places where you use any link, call that service to process the link and return the updated link that you get from the service.
You need to write a service to process the links based on whatever the criteria you want.
Now in each of the component/places where you use any link, call that service to process the link and return the updated link that you get from the service.
Hi @nydel09 You need to implement sling reverse mapping for this that will resolve the issue.
Please refer this article for reverse sling mapping to remove /content reference inside the rendered web pages
Regards,
Rajashankar.R
Views
Likes
Replies
Views
Likes
Replies