Skip to content

moonwalker/sitemapgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sitemapgen

sitemapgen is a Go library to easy generate sitemap.xml files that follows to sitemap protocol

sitemapgen also supports localization urls following the xhtml specification. Read more on google sitemap alternate language

Usage

import (
    "fmt"
    "github.com/moonwalker/sitemapgen"
)
// Create sitemap object to work with
sitemap := sitemapgen.CreateSitemap()

// Create url for an location
u := sitemapgen.CreateUrl("http://example.example/slug")

// Sets the changefreq for the url
u.SetChangeFreq(sitemapgen.WEEKLY)

// Add url to sitemap
sitemap.AddUrl(u)

// Write sitemap to file
err := sitemap.WriteToFile("sitemap.xml")
if err != nil {
    fmt.Printf("Error creating sitemap: %v\n", err)
}

About

Go library for generating sitemaps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages