Expand my Community achievements bar.

SOLVED

Sitemap using ACS Commons - how to remove /content/ from urls

Avatar

Level 2

Hello friends, 

I am using ACS Commons Sitemap Servlet to generate sitemap xml which looks like..

<url>
<loc>
https://<Domain Name>/content/site/testing.html
</loc>
</url>
<url>

I want to get rid of /content/site/ from the url as this is how our urls are in production so that it looks like

https://<Domain Name>/testing.html

Could anyone please advise how can I achieve that? 

SitemapServlet config looks like. Anything I can put here? 

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:OsgiConfig"
    exclude.property="hideInNav"
    externalizer.domain="publicSecure"
    sling.servlet.resourceTypes="sometemplate"/>

Thanks and Regards

Deepak

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

I don't think ACS commons can remove it, but you can always add an resource resolver config for your runmode like below , worked fine.

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig" resource.resolver.searchpath="[/apps,/libs,/apps/foundation/components/primary,/libs/foundation/components/primary]" resource.resolver.manglenamespaces="{Boolean}true" resource.resolver.allowDirect="{Boolean}true" resource.resolver.required.providers="org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory" resource.resolver.virtual="/:/" resource.resolver.mapping="[/content/project/&lt;/]" resource.resolver.map.location="/etc/map" resource.resolver.default.vanity.redirect.status="{Long}302" resource.resolver.enable.vanitypath="{Boolean}true" resource.resolver.optimize.alias.resolution="{Boolean}true" />

 

It will remove /content/project from generated sitemap.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

I don't think ACS commons can remove it, but you can always add an resource resolver config for your runmode like below , worked fine.

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig" resource.resolver.searchpath="[/apps,/libs,/apps/foundation/components/primary,/libs/foundation/components/primary]" resource.resolver.manglenamespaces="{Boolean}true" resource.resolver.allowDirect="{Boolean}true" resource.resolver.required.providers="org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory" resource.resolver.virtual="/:/" resource.resolver.mapping="[/content/project/&lt;/]" resource.resolver.map.location="/etc/map" resource.resolver.default.vanity.redirect.status="{Long}302" resource.resolver.enable.vanitypath="{Boolean}true" resource.resolver.optimize.alias.resolution="{Boolean}true" />

 

It will remove /content/project from generated sitemap.

Avatar

Level 2

Hi edubey,

Sorry for replying late. Thanks a lot for posting this solution. It worked for me. 

Regards,

Deepak