Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Issue with customized sitemap generator of servicepack11

Avatar

Level 2

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.

5 Replies

Avatar

Community Advisor

Hi @Vani1012 

 

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

 

Thanks,

Kiran Vedantam.

Avatar

Level 2

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

Community Advisor

Hi @Vani1012 

 

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

 

Thanks,

Kiran Vedantam.