Commit 29fea42a authored by dfabulich's avatar dfabulich
Browse files

Merge pull request #3 from mkurz/sitemapIndexFix

Allow to create index even when only (one) sitemap.xml exists
parents cd96b384 20530f27
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -187,6 +187,13 @@ public class SitemapIndexGenerator {
	 * @param count the number of sitemaps (1-based)
	 */
	public SitemapIndexGenerator addUrls(String prefix, String suffix, int count) {
		if (count == 0) {
			try {
				addUrl(new URL(baseUrl, prefix + suffix));
			} catch (MalformedURLException e) {
				throw new RuntimeException(e);
			}
		} else {
			for (int i = 1; i <= count; i++) {
				String fileName = prefix + i + suffix;
				try {
@@ -195,6 +202,7 @@ public class SitemapIndexGenerator {
					throw new RuntimeException(e);
				}
			}
		}
		return this;
	}