Documentation
¶
Overview ¶
Package sitemap generates site mappings and a mapping indexes that can be rendered in XML. Sitemaps are used to direct search engines how to navigate their site crawls. As Defacto2 has 100,000s of hyperlinks with many generated from the database. We need to limit the search engines to avoid them wasting their crawl quote on duplicated linkage.
Useful links,
Index ¶
Constants ¶
const ( Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9" RootURL = "https://defacto2.net" Website = "sitemap.xml" Releaser = "sitemap-releaser.xml" Magazine = "sitemap-magazine.xml" BBS = "sitemap-bbs.xml" FTP = "sitemap-ftp.xml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct { XMLName xml.Name `xml:"sitemapindex"` XMLNS string `xml:"xmlns,attr"` Maps []Map }
Index is a xml sitemap index file that is a centralized collection of all the sitemaps used on the site.
An example output:
<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap> <loc>https://www.example.com/sitemap1.xml.gz</loc> <lastmod>2024-08-15</lastmod> </sitemap> <sitemap> <loc>https://www.example.com/sitemap2.xml.gz</loc> <lastmod>2022-06-05</lastmod> </sitemap>
</sitemapindex>
See package documentation for links.
type Loc ¶
type Loc struct { XMLName xml.Name `xml:"url"` Loc string `xml:"loc"` LastMod string `xml:"lastmod,omitempty"` }
Loc is the URL location of the website page.
type Map ¶
type Map struct { XMLName xml.Name `xml:"sitemap"` Loc string `xml:"loc"` LastMod string `xml:"lastmod,omitempty"` }
Map is the URL location of the sitemap.
type Sitemap ¶
Sitemap is an xml sitemap file that links to the all the website pages that should be crawled and index by search engines.
An example output:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <loc>https://www.example.com/foo.html</loc> <lastmod>2022-06-04</lastmod> </url>
</urlset>
See package documentation for links.
func MapBBS ¶
MapBBS generates the sitemap that links to every bbs page that is public. It must be handled by either the XML or XMLPretty echo contexts.
func MapFTP ¶
MapFTP generates the sitemap that links to every ftp page that is public. It must be handled by either the XML or XMLPretty echo contexts.
func MapMagzine ¶
MapMagazine generates the sitemap that links to every magazine page that is public. It must be handled by either the XML or XMLPretty echo contexts.
func MapReleaser ¶
MapReleaser generates the sitemap that links to every releaser page that is public. It must be handled by either the XML or XMLPretty echo contexts.