Skip to content

Commit ee68572

Browse files
jirka.pinkas@gmail.comjirka.pinkas@gmail.com
authored andcommitted
v3.13
1 parent f03016b commit ee68572

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ First add this library to classpath:
1212
<dependency>
1313
<groupId>cz.jiripinkas</groupId>
1414
<artifactId>jsitemapgenerator</artifactId>
15-
<version>3.12</version>
15+
<version>3.13</version>
1616
</dependency>
1717

1818
If you want to use "ping google / bing" functionality, also add this library to classpath:
@@ -27,7 +27,8 @@ If you want to use "ping google / bing" functionality, also add this library to
2727

2828
```java
2929
String sitemap = SitemapGenerator.of("https://example.com")
30-
.addPage(WebPage.of("foo.html")) // simplest way of creating web page
30+
.addPage("foo2.html") // simplest way how to add page - shorthand for addPage(WebPage.of("foo2.html"))
31+
.addPage(WebPage.of("foo1.html")) // same as addPage("foo1.html")
3132
.addPage(WebPage.builder().name("bar.html").build()) // builder is more complex
3233
.addPage(WebPage.builder().maxPriorityRoot().build()) // builder has lots of useful methods
3334
.toString();
@@ -38,8 +39,8 @@ or sitemap in gzip format:
3839
```java
3940
byte[] sitemap = SitemapGenerator.of("https://example.com")
4041
.addPage(WebPage.builder().maxPriorityRoot().build())
41-
.addPage(WebPage.of("foo.html"))
42-
.addPage(WebPage.of("bar.html"))
42+
.addPage("foo.html")
43+
.addPage("bar.html")
4344
.toGzipByteArray();
4445
```
4546

@@ -50,11 +51,11 @@ String sitemap = SitemapGenerator.of("https://example.com")
5051
.addPage(WebPage.builder().maxPriorityRoot().build()) // URL will be: "/"
5152
.defaultExtension("html")
5253
.defaultDir("dir1")
53-
.addPage(WebPage.of("foo")) // URL will be: "dir1/foo.html"
54-
.addPage(WebPage.of("bar")) // URL will be: "dir1/bar.html"
54+
.addPage("foo") // URL will be: "dir1/foo.html"
55+
.addPage("bar") // URL will be: "dir1/bar.html"
5556
.defaultDir("dir2")
56-
.addPage(WebPage.of("hello")) // URL will be: "dir2/hello.html"
57-
.addPage(WebPage.of("yello")) // URL will be: "dir2/yello.html"
57+
.addPage("hello") // URL will be: "dir2/hello.html"
58+
.addPage("yello") // URL will be: "dir2/yello.html"
5859
// btw. specifying dir and / or extension on WebPage overrides default settings
5960
.addPage(WebPage.builder().dir("dir3").extension(null).name("test").build()) // "dir3/test"
6061
.resetDefaultDir() // resets default dir
@@ -97,8 +98,8 @@ or to store it to file & ping google:
9798
SitemapGenerator sg = SitemapGenerator.of("https://example.com");
9899
// add some URLs
99100
sg.addPage(WebPage.builder().maxPriorityRoot().changeFreqNever().lastModNow().build())
100-
.addPage(WebPage.of("foo.html"))
101-
.addPage(WebPage.of("bar.html"));
101+
.addPage("foo.html")
102+
.addPage("bar.html");
102103
// generate sitemap and save it to file ./sitemap.xml
103104
sg.constructAndSaveSitemap(Paths.get("sitemap.xml"));
104105
// inform Google that this sitemap has changed
@@ -109,8 +110,8 @@ sg.pingGoogle(); // this requires okhttp in classpath!!!
109110

110111
```java
111112
String sitemapIndex = SitemapIndexGenerator.of("https://javalibs.com")
112-
.addPage(WebPage.of("sitemap-plugins.xml"))
113-
.addPage(WebPage.of("sitemap-archetypes.xml"))
113+
.addPage("sitemap-plugins.xml")
114+
.addPage("sitemap-archetypes.xml")
114115
.toString();
115116
```
116117

0 commit comments

Comments
 (0)