Skip to content

Is a package that generate XML sitemap from the given page objects.

License

Notifications You must be signed in to change notification settings

alexandrestein/sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

sitemap

Is a package that generate XML sitemap from the given page objects.

It implement the sitemap page and sitemap index.

Documentation can be found at: http://godoc.org/github.com/alexandreStein/sitemap

Example:

package main

import (
	"fmt"
	"time"

	"github.com/alexandreStein/sitemap"
)

func main() {
	// Set the last modification to now
	now := time.Now()

	// Initialize a standard sitemap
	sMap := sitemap.Page{
		Urlset: []*sitemap.Sitemap{
			&sitemap.Sitemap{
				Loc:        "https://www.test.com",
				LastMod:    &now,
				Changefreq: sitemap.Daily,
				Priority:   0.5,
			},
		},
	}
	// Build the XML output
	x, err := sMap.GetXML()
	fmt.Println(string(x), err)

	// Initialize an index sitemap
	sMapi := sitemap.IndexPage{
		Urlset: []*sitemap.Sitemap{
			&sitemap.Sitemap{
				Loc: "https://www.test.com/sitemap.xml",
			},
		},
	}
	// Same as sitemap page build the XML using GetXML
	x, err = sMapi.GetXML()
	fmt.Println(string(x), err)
}

About

Is a package that generate XML sitemap from the given page objects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages