public class WebSitemapGenerator extends Object
builder(URL, File)
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_URLS_PER_SITEMAP
50000 URLs per sitemap maximum
|
| Constructor and Description |
|---|
WebSitemapGenerator(String
Configures the generator with a base URL and a null directory.
|
WebSitemapGenerator(String
Configures the generator with a base URL and directory to write the sitemap files.
|
WebSitemapGenerator(URL
Configures the generator with a base URL and a null directory.
|
WebSitemapGenerator(URL
Configures the generator with a base URL and directory to write the sitemap files.
|
| Modifier and Type | Method and Description |
|---|---|
THIS |
addUrl(String
Add one URL of the appropriate type to this sitemap.
|
THIS |
addUrl(U url)
Add one URL of the appropriate type to this sitemap.
|
THIS |
addUrl(URL
Add one URL of the appropriate type to this sitemap.
|
THIS |
addUrls(Iterable
Add multiple URLs of the appropriate type to this sitemap, one at a time.
|
THIS |
addUrls(String
Add multiple URLs of the appropriate type to this sitemap, one at a time.
|
THIS |
addUrls(U... urls)
Add multiple URLs of the appropriate type to this sitemap, one at a time.
|
THIS |
addUrls(URL
Add multiple URLs of the appropriate type to this sitemap, one at a time.
|
static SitemapGeneratorBuilder |
builder(String
Configures a builder so you can specify sitemap generator options
|
static SitemapGeneratorBuilder |
builder(URL
Configures a builder so you can specify sitemap generator options
|
List |
write()
Write out remaining URLs; this method can only be called once.
|
List |
writeAsStrings()
Writes out the sitemaps as a list of strings.
|
void |
writeSitemapsWithIndex()
After you've called
write(), call this to generate a sitemap index of all sitemaps you generated.
|
public static final int MAX_URLS_PER_SITEMAP
public WebSitemapGenerator(StringbaseUrl, File baseDir) throws MalformedURLException
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
MalformedURLException
public WebSitemapGenerator(URLbaseUrl, File baseDir)
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
public WebSitemapGenerator(StringbaseUrl) throws MalformedURLException
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
MalformedURLException
public WebSitemapGenerator(URLbaseUrl)
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
public static SitemapGeneratorBuilder<WebSitemapGenerator > builder(URL baseUrl, File baseDir)
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
public static SitemapGeneratorBuilder<WebSitemapGenerator > builder(String baseUrl, File baseDir) throws MalformedURLException
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
MalformedURLException
public THIS addUrl(U url)
allowMultipleSitemaps is false, or else write out one sitemap immediately.
url - the URL to add to this sitemap
public THIS addUrls(Iterable<? extends U> urls)
allowMultipleSitemaps is false, or write out one sitemap immediately.
urls - the URLs to add to this sitemap
public THIS addUrls(U... urls)
allowMultipleSitemaps is false, or write out one sitemap immediately.
urls - the URLs to add to this sitemap
public THIS addUrls(String... urls) throws MalformedURLException
allowMultipleSitemaps is false, or write out one sitemap immediately.
urls - the URLs to add to this sitemap
MalformedURLException -
public THIS addUrl(Stringurl) throws MalformedURLException
allowMultipleSitemaps is false, or else write out one sitemap immediately.
url - the URL to add to this sitemap
MalformedURLException -
public THIS addUrls(URL... urls)
allowMultipleSitemaps is false, or write out one sitemap immediately.
urls - the URLs to add to this sitemap
public THIS addUrl(URLurl)
allowMultipleSitemaps is false, or write out one sitemap immediately.
url - the URL to add to this sitemap
public List<File > write()
writeSitemapsWithIndex().
public List<String > writeAsStrings()
public void writeSitemapsWithIndex()
write(), call this to generate a sitemap index of all sitemaps you generated.