Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSiteMap ¶
NewSiteMap takes the root url of the site and the maximum depth of the sitemap and returns a new sitemap
Types ¶
type ErrCachedNode ¶
type ErrCachedNode error
type ErrInvalidNode ¶
type ErrInvalidNode error
type SiteMap ¶
type SiteMap interface {
// AddChild adds a valid url child node to the parent.
// Otherwise returns an error.
// a valid url child should:
// - have the same Hostname as the parent
// - have its parent path as a prefix of its own path
// - have its depth less than max depth
// - not have been visited already
AddChild(parent, child URLNode) error
// Marshal returns the json encoding of the sitemap
Marshal() ([]byte, error)
}
type URLNode ¶
type URLNode interface {
// GetURL returns the URL struct of the node
GetURL() *url.URL
// GetHostName returns the url's hostname
GetHostName() string
// GetPath returns the url's path
GetPath() string
// GetDepth returns the url's depth
GetDepth() int
// Marshal returns the json encoding of url node
Marshal() ([]byte, error)
}
Click to show internal directories.
Click to hide internal directories.