Apache sling sitemap not showing lastmod element in xml. | Community
Skip to main content
MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 2, 2023

Apache sling sitemap not showing lastmod element in xml.

  • March 2, 2023
  • 3 replies
  • 3553 views

Hi,

 

In my case, I'm using Apache Sling sitemap, but it does not display the lastmod tag. Could anyone tell me what I am doing wrong so that I can fix it? 

 

I am sharing my config screenshot for reference.

 

 In the above config i tried both last modified and last replicated.

 

Here is the document I am referring to

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/overview/seo-and-url-management.html?lang=en#building-an-xml-sitemap-on-aem

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Jagadeesh_Prakash
Community Advisor
Community Advisor
March 2, 2023

@mayursatav  Below is an example where we used in one of our project

 

{
"sling.servlet.resourceTypes":[
"XXXXX/components/structure/rootpage"
],
"use.vanity":false,
"include.lastmod":true,
"character.encoding":"",
"extensionless.urls":false,
"exclude.templates":"",
"changefreq.properties":[
"frequency"
],
"remove.slash":true,
"url.rewrites":[
"/content/XXXXX"
],
"include.inherit":false,
"damassets.property":"",
"damassets.types":[
""
],
"priority.properties":[
"priority"
],
"exclude.property":"includeInSitemap",
"externalizer.domain":"sitepublish"
}

 If still it is not working then their could be another chance that 

content may not have a last modification date: The lastmod tag is generated based on the last modification date of the content. If the content has not been modified recently, the tag may not be displayed in the sitemap 

MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 2, 2023

Thank @jagadeesh_prakash  for the quick response. Seems you are using acs commons sitemap right ?. This config will not for apache sling sitemap we have separate configs for different sections for example last modified related config we have com.adobe.aem.wcm.seo.impl.sitemap.PageTreeSitemapGeneratorImpl config.

{ "lastModifiedSource": "cq:lastModified", "enableLastModified": true }



Jagadeesh_Prakash
Community Advisor
Community Advisor
March 2, 2023

@mayursatav My bad i did read your ask but did not realize that its an apache sling.Can you also try setting addLastMod=true in PageTreeSitemapGeneratorImpl configration

arunpatidar
Community Advisor
Community Advisor
March 2, 2023
Arun Patidar
MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 3, 2023

Hi @arunpatidar ,
Thank you for your response. I have tried the suggested approach, but it is still not working. Do I need to add an entry for this generator somewhere in the configuration? As per that blog we have to include it in scheduler config but we don't want to use scheduler.

somen-sarkar
Community Advisor
Community Advisor
March 3, 2023

Hi,

Tried the OOTB Apache Sling Sitemap with  wknd site .  For pulish instance using the value cq:lastModified is generating the lastmod tag in  sitemap . Don't think extending the sitemapGenerator is required unless any site specific functionality is required , Below are the screenshots. 

 

Thanks,

Somen

MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 3, 2023

Hi @somen-sarkar ,


Thanks for the reply, You are right we don't need to extend sitemap class. Bcoz they have already given config for lastmod date inclusion as i mentioned in my reply. I tried with WKND, there it is working fine. but don't know somehow it is not working with my project. Is there any config that we need to check and update?