sitemap.xml站点描述文件生成器,只需要配置站点及其需过滤的目录即可。该组件是果凡网www.gonvan.com 基于htmlParser编写,可直接部署到站点下。
<dependency> <groupId>com.gonvan</groupId> <artifactId>sitemap</artifactId> <version>0.1.1.RELEASE</version></dependency>
示例代码:
HtmlCrawler crawler = HtmlCrawler.getInstance("https://www.gonvan.com/",Arrays.asList("/assets", "/image");SitemapGenerator generator = SitemapGenerator.getInstance(FSConfig.getSiteDir(), "https://www.gonvan.com/");try {generator.writeSiteMap(crawler.crawl());} catch (MalformedURLException e) {logger.error("sitemap.xml write error:", e);}
评论