Hi,
We are using the OOTB sitemap scheduler generation, and it's working as per the adobe tutorial, only problem is that our SEO team wants absolute URLs instead of the relative ones that we are getting:
https://mysite.net/content/mysite/mypage.sitemap.xml
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @SamFlyn
You would have to implement the shortening of URL to remove the /content from the sitemap generation. This can be handle by the following ways:-
1. Using sling mapping by setting node definition under /etc/map/https
2. Using sling resource resolver rules. Using the web console (for example, localhost:4502/system/console/configMgr) you can configure the Sling Resource Resolver:
Apache Sling Resource Resolver Factory
(org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl).
Here are the some links that you can follow to implement the shortening of URL in the sitemap.
https://experienceleague.adobe.com/docs/experience-manager-learn/sites/seo/sitemaps.html?lang=en
https://blog.3sharecorp.com/shortening-urls-in-aem
Hope this helps.
Hi @SamFlyn
You would have to implement the shortening of URL to remove the /content from the sitemap generation. This can be handle by the following ways:-
1. Using sling mapping by setting node definition under /etc/map/https
2. Using sling resource resolver rules. Using the web console (for example, localhost:4502/system/console/configMgr) you can configure the Sling Resource Resolver:
Apache Sling Resource Resolver Factory
(org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl).
Here are the some links that you can follow to implement the shortening of URL in the sitemap.
https://experienceleague.adobe.com/docs/experience-manager-learn/sites/seo/sitemaps.html?lang=en
https://blog.3sharecorp.com/shortening-urls-in-aem
Hope this helps.
you can add the domains in the Link externalizer(https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/externalizer.html?...) and useApache Sling Resource Resolver Factory to remove /content part
or you have to extend the implementation like
@arunpatidar Our situation is similar in that we don't have the /etc/mapping file and instead rely on the org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl to control everything. However, like you, we are still getting relative URLs instead of absolute ones. I came across your code and noticed that we have a similar custom code, but I'm not sure how it will assist us in rendering the URLs with the appropriate domain. I'm hesitant to resort to writing messy code that involves retrieving the domain and appending it to the URL. Do we the proper way to fix this with New Sling Sitemap Generator ?
Can you check wknd code? There it has absolute urls.
https://wknd.site/us/en.sitemap.xml
I believe you can write a logic here if Link externalizer andJcrResourceResolverFactoryImpl config do not solve the issue
Thank you for your response @arunpatidar .
Do you have the latest repo URL for wknd? The following ones don't seem to be inlined with the cloud https://github.com/adobe/aem-guides-wknd
And yes I am manipulating the code as you mentioned but that again is a dirty way I feel.
The osgi configs are at https://github.com/adobe/aem-guides-wknd/blob/main/ui.config/src/main/content/jcr_root/apps/wknd/osg...
I don't think so https://wknd.site/us/en.sitemap.xml is generated by OOTB sitemap generator.
You can continue to write custom logic to append domain
@arunpatidar Upon noticing the logs I see that the
SitemapGeneratorImpl extends ResourceTreeSitemapGenerator
is never hitting which is why custom logic is also failing. When I track the requests the sitemap is only calling
org.apache.sling.sitemap.impl.SitemapServlet
and the sitemap is getting generated. I have tried changing the ranking of that Impl but I don't think it will ever it that.