Simple sitemap formatting, with a little syntactic sugar.
go get github.com/mingard/sitemap-format
package main
import sitemap "github.com/mingard/sitemap-format"
func main() {
xml := sitemap.New()
loc := sitemap.NewLoc()
loc.SetLocation("https://domain.com")
xml.Add(loc)
out, _ := xml.OutputString()
fmt.Println(out)
}
// Output: <?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://domain.com</loc><lastmod>2022-11-03T11:56:00.26065Z</lastmod></url></urlset>