


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.
Views
Replies
Total Likes
Hi @Vani1012
Can you please check what your logs are saying and share it here?
Thanks,
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
Views
Replies
Total Likes