sitemap

package
v0.0.0-...-0941746 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeFreq

type ChangeFreq string

ChangeFreq specifies change frequency of a sitemap entry. It is just a string.

const (
	Always  ChangeFreq = "always"
	Hourly  ChangeFreq = "hourly"
	Daily   ChangeFreq = "daily"
	Weekly  ChangeFreq = "weekly"
	Monthly ChangeFreq = "monthly"
	Yearly  ChangeFreq = "yearly"
	Never   ChangeFreq = "never"
)

type Sitemap

type Sitemap struct {
	XMLName xml.Name `xml:"urlset"`
	Xmlns   string   `xml:"xmlns,attr"`
	Urls    []URL    `xml:"url"`
	// contains filtered or unexported fields
}

func New

func New(minify bool) *Sitemap

New returns a new Sitemap.

func (*Sitemap) Add

func (sitemap *Sitemap) Add(url URL)

Add adds an URL to a Sitemap.

func (*Sitemap) String

func (sitemap *Sitemap) String() (ret string, err error)

func (*Sitemap) WriteTo

func (sitemap *Sitemap) WriteTo(w io.Writer) (err error)

WriteTo writes XML encoded sitemap to given io.Writer. Implements io.WriterTo.

type URL

type URL struct {
	Loc        string     `xml:"loc"`
	LastMod    *time.Time `xml:"lastmod,omitempty"`
	ChangeFreq ChangeFreq `xml:"changefreq,omitempty"`
	Priority   float32    `xml:"priority,omitempty"`
}

Jump to

Keyboard shortcuts

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