Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Issue with customized sitemap generator of servicepack11

Avatar

Level 8

Hi,

 

I am creating sitemapGenratorImpl class to customize sitemap, this is the code I added

@Component(
service = SitemapGenerator.class,
property = { "service.ranking:Integer=20" }
)
public class SitemapGeneratorImpl extends ResourceTreeSitemapGenerator {

private static final Logger LOG = LoggerFactory.getLogger(SitemapGeneratorImpl.class);

@Reference
private SitemapLinkExternalizer externalizer;
/*@Reference
private PageTreeSitemapGenerator defaultGenerator;*/
public void hello(){
LOG.info("hello from official doc of sitemap");
}

@Override
protected void addResource(@NotNull String name, @NotNull Sitemap sitemap, Resource resource) throws SitemapException {
Page page = resource.adaptTo(Page.class);
LOG.info("new sitemap");
if (page == null) {
LOG.debug("Skipping resource at {}: not a page", resource.getPath());
return;
}
String location = externalizer.externalize(resource);
Url url = sitemap.addUrl(location + ".html");
// add any additional content to the Url like lastmod, change frequency, etc
}

And in the osgi config console I added this sitemap generator class in the include generator of scheduler,PFA Screenshot (70).png But its not picking the custom, still OOTB Sitemap generator is getting called.

6 Replies

Avatar

Community Advisor

Hi @Vani1012 

 

Can you please check what your logs are saying and share it here?

 

Thanks,

Kiran Vedantam.

Avatar

Level 8

Hi @Kiran_Vedantam 

 

Im not getting any errors I written some log inside the code na(

LOG.debug("Skipping resource at {}: not a page", resource.getPath()
LOG.info("hello from official doc of sitemap");
}
);

) they are not coming on error.log file

Avatar

Level 8

Hi @Kiran_Vedantam ,

 

I am unable to share my error.log file the allowed extensionsScreenshot (71).png

Avatar

Community Advisor

Hi @Vani1012 

 

Can you make the log level to info and check the error.log?

 

Thanks,

Kiran Vedantam.

Avatar

Community Advisor

Hi @Vani1012 ,
Is your query resolved ? could you please add your solution.

 

Thanks