ikeikeikeike / go-sitemap-generator

go-sitemap-generator is the easiest way to generate Sitemaps in Go
https://github.com/ikeikeikeike/go-sitemap-generator
MIT License
220 stars 65 forks source link

Generates sitemap1.xml.gz instead of sitemap.xml.gz #37

Open vintikzzz opened 4 years ago

vintikzzz commented 4 years ago

Hi! I have code like this:

    sm := stm.NewSitemap(0)
    sm.Create()
    sm.SetDefaultHost("https://example.org")
    sm.SetPublicPath(".")
    sm.SetCompress(true)
    // sm.SetSitemapsPath(".")
    sm.SetAdapter(&S3Adapter{})
    sm.Add(stm.URL{{"loc", ""}, {"changefreq", "daily"}})
    if err := makeThreadsSitemap(db, sm); err != nil {
        return errors.Wrap(err, "failed to generate sitemap for threads")
    }
    sm.Finalize().PingSearchEngines()
    log.Println("finish")

That outputs this log:

2020/08/09 18:56:04 start
2020/08/09 18:56:07 /go-sitemap-generator/v2/stm/sitemap.go:14: Max processors 6
sitemaps/sitemap1.xml.gz '6143' links
Ping now: http://www.bing.com/webmaster/ping.aspx?siteMap=https://example.org/sitemaps//sitemap.xml.gz
Ping now: http://www.google.com/webmasters/tools/ping?sitemap=https://example.org/sitemaps//sitemap.xml.gz
Successful ping of `http://www.google.com/webmasters/tools/ping?sitemap=https://example.org/sitemaps//sitemap.xml.gz`
Successful ping of `http://www.bing.com/webmaster/ping.aspx?siteMap=https://example.org/sitemaps//sitemap.xml.gz`
2020/08/09 18:56:29 finish

There is no index file in my case. Only first sitemap chunk. And also there is double slashes in ping-urls.