parser

package
v0.0.0-...-13999d3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalXML

func MarshalXML(filePath string, sitemap *Sitemap) error

MarshalXML marshals struct into XML file

func UnmarshalXML

func UnmarshalXML(filePath string, sitemap *Sitemap) error

UnmarshalXML unmarshals XML file into struct

Types

type Sitemap

type Sitemap struct {
	// XMLName is required. Encapsulates the file and references the current protocol standard.
	XMLName xml.Name `xml:"urlset"`
	//Urls is required. Parent tag for each URL entry. The remaining tags are children of this tag.
	Urls []SitemapURL `xml:"url"`
}

Sitemap is the root element of the XML file

func UrlsToSitemap

func UrlsToSitemap(urlset *url.URL, urls []*url.URL) *Sitemap

UrlsToSitemap - converts slice of URLs to Sitemap with urlset given url as first argument

type SitemapURL

type SitemapURL struct {
	// Loc required URL of the page. This URL must begin with the protocol (such as http) and end with a trailing slash, if your web server requires it. This value must be less than 2,048 characters.
	Loc string `xml:"loc"`
	// Lastmod is optional. TODO: implement
	LastMod string `xml:"lastmod"`
	// ChangeFreq is optional. TODO: implement
	ChangeFreq string `xml:"changefreq"`
	// Priority is optional. TODO: implement
	Priority string `xml:"priority"`
}

SitemapURL is a single URL in a sitemap

Jump to

Keyboard shortcuts

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