sitemap

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 8 Imported by: 0

README

go-sitemap

Build Status

go-sitemap get sitemap.xml (or sitemapindex.xml) and generate Sitemap object.

Installation

go get github.com/yterajima/go-sitemap

Usage

See example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFetch

func SetFetch(f func(URL string, options interface{}) ([]byte, error))

SetFetch change fetch closure

func SetInterval

func SetInterval(time time.Duration)

SetInterval change Time interval to be used in Index.get

Types

type Index

type Index struct {
	XMLName xml.Name `xml:"sitemapindex"`
	Sitemap []parts  `xml:"sitemap"`
}

Index is a structure of <sitemapindex>

func ParseIndex

func ParseIndex(data []byte) (idx Index, err error)

ParseIndex create Index data from text

type Sitemap

type Sitemap struct {
	XMLName xml.Name `xml:"urlset"`
	URL     []URL    `xml:"url"`
}

Sitemap is a structure of <sitemap>

func Get

func Get(URL string, options interface{}) (Sitemap, error)

Get sitemap data from URL

func Parse

func Parse(data []byte) (smap Sitemap, err error)

Parse create Sitemap data from text

type URL

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

URL is a structure of <url> in <sitemap>

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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