Skip to content

Simple sitemap formatting, with a little syntactic sugar

License

Notifications You must be signed in to change notification settings

mingard/sitemap-format

Repository files navigation

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>

About

Simple sitemap formatting, with a little syntactic sugar

Resources

License

Stars

Watchers

Forks

Packages

No packages published