sitemap_go

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alternate

type Alternate struct {
	Rel      string `xml:"rel,attr"`
	HrefLang string `xml:"hreflang,attr"`
	Href     string `xml:"href,attr"`
}

type ChangeFreq

type ChangeFreq string
const (
	ChangeFreqAlways  ChangeFreq = "always"
	ChangeFreqHourly  ChangeFreq = "hourly"
	ChangeFreqDaily   ChangeFreq = "daily"
	ChangeFreqWeekly  ChangeFreq = "weekly"
	ChangeFreqMonthly ChangeFreq = "monthly"
	ChangeFreqYearly  ChangeFreq = "yearly"
	ChangeFreqNever   ChangeFreq = "never"
)

type Image

type Image struct {
	Loc     string `xml:"image:loc"`
	Caption string `xml:"image:caption,omitempty"`
	Title   string `xml:"image:title,omitempty"`
}

type SitemapEntry added in v1.0.5

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

type SitemapIndex added in v1.0.5

type SitemapIndex struct {
	XMLName xml.Name `xml:"sitemapindex"`

	Sitemaps []SitemapEntry `xml:"sitemap"`
	// contains filtered or unexported fields
}

func MakeSitemapIndex added in v1.0.5

func MakeSitemapIndex(entries []SitemapEntry) SitemapIndex

func ParseXMLSitemapIndex added in v1.0.5

func ParseXMLSitemapIndex(content string) (SitemapIndex, error)

func (*SitemapIndex) Add added in v1.0.5

func (si *SitemapIndex) Add(loc string, lastMod time.Time)

func (*SitemapIndex) GenerateXML added in v1.0.5

func (si *SitemapIndex) GenerateXML() (string, error)

type URL

type URL struct {
	Loc        string      `xml:"loc"`
	LastMod    *time.Time  `xml:"lastmod,omitempty"`
	ChangeFreq ChangeFreq  `xml:"changefreq,omitempty"`
	Priority   *float64    `xml:"priority,omitempty"`
	Images     []Image     `xml:"image:image,omitempty"`
	Videos     []Video     `xml:"video:video,omitempty"`
	Alternate  []Alternate `xml:"xhtml:link,omitempty"`
}

func MakeUrl

func MakeUrl(loc string, options ...UrlOption) *URL

type URLSet

type URLSet struct {
	XMLName xml.Name `xml:"urlset"`
	XMLNS   string   `xml:"xmlns,attr"`
	XHTML   string   `xml:"xmlns:xhtml,attr,omitempty"`
	Image   string   `xml:"xmlns:image,attr,omitempty"`
	Video   string   `xml:"xmlns:video,attr,omitempty"`
	URLs    []*URL   `xml:"url"`
}

func MakeUrlSet added in v1.0.6

func MakeUrlSet() URLSet

func ParseXMLUrlSet added in v1.0.5

func ParseXMLUrlSet(content string) (URLSet, error)

func (*URLSet) Add

func (u *URLSet) Add(url *URL)

func (*URLSet) GenerateXML

func (u *URLSet) GenerateXML() (string, error)

type UrlOption

type UrlOption func(*URL)

func WithChangeFreq

func WithChangeFreq(f ChangeFreq) UrlOption

func WithImages

func WithImages(img []Image) UrlOption

func WithLastMod

func WithLastMod(t time.Time) UrlOption

func WithPriority

func WithPriority(p float64) UrlOption

func WithVideosVideos

func WithVideosVideos(m []Video) UrlOption

type Video

type Video struct {
	Loc          string   `xml:"video:loc"`
	ThumbnailLoc string   `xml:"video:thumbnail_loc"`
	Title        string   `xml:"video:title"`
	Description  string   `xml:"video:description"`
	ContentLoc   string   `xml:"video:content_loc,omitempty"`
	Duration     int      `xml:"video:duration,omitempty"`
	Category     string   `xml:"video:category,omitempty"`
	Tags         []string `xml:"video:tag,omitempty"`
}

Jump to

Keyboard shortcuts

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