sitemap

package
v1.18.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sitemap

type Sitemap struct {
	XMLName   xml.Name
	Namespace string `xml:"xmlns,attr"`

	URLs     []URL `xml:"url"`
	Sitemaps []URL `xml:"sitemap"`
}

Sitemap represents a sitemap

func NewSitemap

func NewSitemap() *Sitemap

NewSitemap creates a sitemap

func NewSitemapIndex

func NewSitemapIndex() *Sitemap

NewSitemapIndex creates a sitemap index.

func (*Sitemap) Add

func (s *Sitemap) Add(u URL)

Add adds a URL to the sitemap

func (*Sitemap) WriteTo

func (s *Sitemap) WriteTo(w io.Writer) (int64, error)

WriteTo writes the sitemap to a response

type URL

type URL struct {
	URL     string     `xml:"loc"`
	LastMod *time.Time `xml:"lastmod,omitempty"`
}

URL represents a single sitemap entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL