Home

Awesome

Sitemap Format

Coverage godoc Go Report Card Codacy Badge

Simple sitemap formatting, with a little syntactic sugar.

Installation

go get github.com/mingard/sitemap-format

Usage

Creating a basic Sitemap

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>