diff options
| author | demo <demo@antix1> | 2026-05-28 13:20:30 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-28 13:20:30 -0400 |
| commit | 6b39b2b04e037b809537ec2b6209b62b114dceaf (patch) | |
| tree | 4a4fdf31b04d203914d46f302c869f0ac6045fbd /xml.go | |
| parent | af1e0e423b86e9a1556bd1a6b9e62478648884a9 (diff) | |
feat: add comment logging maxDepth and maxURLs inside xml output
Diffstat (limited to 'xml.go')
| -rw-r--r-- | xml.go | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -10,6 +10,7 @@ type XMLURLset struct { XMLName xml.Name `xml:"urlset"` Xmlns string `xml:"xmlns,attr"` URLs []URL `xml:"url"` + Comment string `xml:",comment"` } type URL struct { @@ -20,7 +21,7 @@ type Loc struct { Text string `xml:",chardata"` } -func toSitemap(seen map[url.URL]int) (string, error) { +func toSitemap(seen map[url.URL]int, maxDepth, maxURLs int) (string, error) { var xmlURLs []URL for u := range seen { @@ -34,8 +35,9 @@ func toSitemap(seen map[url.URL]int) (string, error) { } set := XMLURLset{ - Xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9", - URLs: xmlURLs, + Xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9", + URLs: xmlURLs, + Comment: fmt.Sprintf("max depth: %d, max urls: %d", maxDepth, maxURLs), } output, err := xml.MarshalIndent(&set, "", "\t") |
