Merge pull request #28 from gregorko/master
Added ability to specify a custom sitemap index file
This commit is contained in:
commit
d4bc63c582
|
@ -208,12 +208,23 @@ abstract class SitemapGenerator<U extends ISitemapUrl, THIS extends SitemapGener
|
||||||
sb.append("</urlset>");
|
sb.append("</urlset>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** After you've called {@link #write()}, call this to generate a sitemap index of all sitemaps you generated.
|
/**
|
||||||
*
|
* After you've called {@link #write()}, call this to generate a sitemap index of all sitemaps you generated.
|
||||||
|
* The sitemap index is written to {baseDir}/sitemap_index.xml
|
||||||
*/
|
*/
|
||||||
public void writeSitemapsWithIndex() {
|
public void writeSitemapsWithIndex() {
|
||||||
if (!finished) throw new RuntimeException("Sitemaps not generated yet; call write() first");
|
if (!finished) throw new RuntimeException("Sitemaps not generated yet; call write() first");
|
||||||
File outFile = new File(baseDir, "sitemap_index.xml");
|
File outFile = new File(baseDir, "sitemap_index.xml");
|
||||||
|
writeSitemapsWithIndex(outFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After you've called {@link #write()}, call this to generate a sitemap index of all sitemaps you generated.
|
||||||
|
*
|
||||||
|
* @param outFile the destination file of the sitemap index.
|
||||||
|
*/
|
||||||
|
public void writeSitemapsWithIndex(File outFile) {
|
||||||
|
if (!finished) throw new RuntimeException("Sitemaps not generated yet; call write() first");
|
||||||
SitemapIndexGenerator sig;
|
SitemapIndexGenerator sig;
|
||||||
sig = new SitemapIndexGenerator.Options(baseUrl, outFile).dateFormat(dateFormat).autoValidate(autoValidate).build();
|
sig = new SitemapIndexGenerator.Options(baseUrl, outFile).dateFormat(dateFormat).autoValidate(autoValidate).build();
|
||||||
sig.addUrls(fileNamePrefix, fileNameSuffix, mapCount).write();
|
sig.addUrls(fileNamePrefix, fileNameSuffix, mapCount).write();
|
||||||
|
|
Loading…
Reference in New Issue