Expand my Community achievements bar.

Apache sling sitemap not showing lastmod element in xml.

Avatar

Community Advisor

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.

MayurSatav_0-1677762734181.png

 

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

 

MayurSatav_1-1677762326734.png

Here is the document I am referring to

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/overview/seo-and-ur...

 

12 Replies

Avatar

Community Advisor

@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 

Avatar

Community Advisor

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
}



Avatar

Community Advisor

@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

Avatar

Community Advisor

I already mentioned in above reply and also tried but doesn't work

Avatar

Community Advisor

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.

Avatar

Community Advisor

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. 

osgi.JPGsitemap.JPG

 

Thanks,

Somen

Avatar

Community Advisor

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?

Avatar

Level 2

Hi 

 

My sitemap is loading as below.

chandrareddy_0-1700219998740.png

 

How to make it load properly?

 

Avatar

Community Advisor

Hi @chandrareddy 
It is correct, you can check the view source.

 

I don't see XML as rendered , could be because of mimetype.



Arun Patidar

Avatar

Level 2

Hi Arun, Thank you. Can you pls suggest, how to enable mime type for OOTB sitemap..