sitemap: github.com/jor-go/sitemap Index | Files | Directories

package sitemap

import "github.com/jor-go/sitemap"

Index

Package Files

sitemap.go

type Sitemap Uses

type Sitemap struct {
    Format  string   `xml:",innerxml"`
    XMLName xml.Name `xml:"urlset"`
    XMLNS   string   `xml:"xmlns,attr"`
    URLS    []URL    `xml:"url"`
}

Sitemap Holds all the urls in the sitemap

func (*Sitemap) AddURL Uses

func (s *Sitemap) AddURL(u URL)

AddURL Adds a single URL to the sitemap

func (*Sitemap) AddURLs Uses

func (s *Sitemap) AddURLs(u []URL)

AddURLs Adds multiple URLs to the Sitemap

func (*Sitemap) Generate Uses

func (s *Sitemap) Generate() ([]byte, error)

Generate Creates sitemap []byte

func (*Sitemap) GenerateAndSave Uses

func (s *Sitemap) GenerateAndSave(path string) error

GenerateAndSave Generates and saves to filepath e.g. "/path/to/your/sitemap.xml"

type URL Uses

type URL struct {
    Loc        string `xml:"loc"`
    LastMod    string `xml:"lastmod"`
    ChangeFreq string `xml:"changefreq"`
    Priority   string `xml:"priority"`
}

URL is a url for the sitemap

func (*URL) New Uses

func (u *URL) New(location, changeFrequency string, priority float64, lastModified time.Time) error

New Creates a new URL for the sitemap.

location: URL e.g. https://...

changeFrequency: "always", "hourly", "daily", "weekly", "monthly", "yearly", or "never"

priority: float between 0.0 and 1.0

lastModified: time.Time of the last time link was modified

func (*URL) TimeToLastMod Uses

func (u *URL) TimeToLastMod(t time.Time)

TimeToLastMod Convert a time.Time to the last modified date as a string

Directories

PathSynopsis
example

Package sitemap imports 6 packages (graph) and is imported by 1 packages. Updated 2019-05-14. Refresh now. Tools for package owners.