Issue with customized sitemap generator of servicepack11 | Community
Skip to main content
Level 6
April 22, 2022

Issue with customized sitemap generator of servicepack11

  • April 22, 2022
  • 2 replies
  • 1781 views

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  But its not picking the custom, still OOTB Sitemap generator is getting called.

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

2 replies

Kiran_Vedantam
Community Advisor
Community Advisor
April 22, 2022

Hi @vani1012 

 

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

 

Thanks,

Kiran Vedantam.

Vani1012Author
Level 6
April 22, 2022

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

MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 26, 2022

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

 

Thanks