Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (32 sloc) 905 Bytes
package stm
import (
// NewSitemapIndexURL and NewSitemapURL are almost the same behavior.
func NewSitemapIndexURL(opts *Options, url URL) SitemapURL {
return &sitemapIndexURL{opts: opts, data: url}
// sitemapIndexURL and sitemapURL are almost the same behavior.
type sitemapIndexURL struct {
opts *Options
data URL
// XML and sitemapIndexURL.XML are almost the same behavior.
func (su *sitemapIndexURL) XML() []byte {
doc := etree.NewDocument()
sitemap := doc.CreateElement("sitemap")
SetBuilderElementValue(sitemap,, "loc")
if _, ok := SetBuilderElementValue(sitemap,, "lastmod"); !ok {
lastmod := sitemap.CreateElement("lastmod")
if su.opts.pretty {
buf := poolBuffer.Get()
bytes := buf.Bytes()
return bytes
You can’t perform that action at this time.