Creates sitemap files
package main
import (
"github.com/pahanini/go-sitemap-generator"
)
g := sitemap.New(sitmap.Options{
Dir: "sitemap",
BaseURL: "http://example.com/",
})
g.Open()
g.Add(sitemap.URL{Location:`http://example.com`, Priority: `0.5`})
g.Add(sitemap.URL{Location:`http://example.com/test`, Priority: `0.5`})
g.Close()
$ go get github.com/pahanini/go-sitemap-generator
Sitemap comes with a variety of configuration options. Available Options:
type Options struct {
// Filename is base file name for sitemap w/o extension
// - single file <filename>.xml
// - many files with sitemap index <filename>.xml index and <filename>-<n>.xml files
Filename string
// Max file size (default 10485760)
MaxFileSize int
// Max links in one file (default 50000)
MaxURLs int
// Dir keeps directory name for sitemap files
Dir string
// BaseURL used for generate sitemap index file
BaseURL string
}