mingard / sitemap-format

Simple sitemap formatting, with a little syntactic sugar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:GNU General Public License v3.0


Languages

Language:Go 98.5%Language:Makefile 1.5%