parse

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeURL

func NormalizeURL(u *url.URL) string

NormalizeURL standardizes a URL for comparison and storage It lowercases the scheme and host, removes default ports (80 for http, 443 for https), removes trailing slashes from paths (unless root "/"), ensures empty path becomes "/", and removes fragments and query strings Does not modify the input *url.URL

func ParseAndNormalize

func ParseAndNormalize(urlStr string) (string, *url.URL, error)

ParseAndNormalize parses a URL string using the stricter url.ParseRequestURI (requiring a scheme) and then normalizes it using NormalizeURL Returns the normalized string, the parsed URL object, and any parse error

Types

type XMLSitemap

type XMLSitemap struct {
	Loc     string `xml:"loc"`
	LastMod string `xml:"lastmod,omitempty"`
}

XMLSitemap represents a <sitemap> element in a sitemap index file

type XMLSitemapIndex

type XMLSitemapIndex struct {
	XMLName  xml.Name     `xml:"sitemapindex"`
	Sitemaps []XMLSitemap `xml:"sitemap"`
}

XMLSitemapIndex represents a <sitemapindex> element

type XMLURL

type XMLURL struct {
	Loc     string `xml:"loc"`
	LastMod string `xml:"lastmod,omitempty"`
}

XMLURL represents a <url> element in a sitemap

type XMLURLSet

type XMLURLSet struct {
	XMLName xml.Name `xml:"urlset"`
	URLs    []XMLURL `xml:"url"`
}

XMLURLSet represents a <urlset> element in a sitemap

Jump to

Keyboard shortcuts

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