seo

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteURL

func AbsoluteURL(base *url.URL, route string) string

AbsoluteURL joins a root-relative route under the configured base URL.

func Handler

func Handler(options HandlerOptions, provider Provider) http.Handler

Handler returns an HTTP handler that merges generated static URLs with an optional app-owned provider. Provider errors return a generic unavailable response and do not expose application error text.

func NormalizeURL

func NormalizeURL(base *url.URL, loc string) (string, error)

NormalizeURL validates one sitemap URL and returns its absolute form.

func ParseBaseURL

func ParseBaseURL(value string) (*url.URL, error)

ParseBaseURL validates the configured site base URL.

func Sitemap

func Sitemap(baseURL string, urls []URL) ([]byte, error)

Sitemap normalizes, de-duplicates, sorts, and serializes sitemap URLs.

Types

type HandlerOptions

type HandlerOptions struct {
	BaseURL        string
	StaticURLs     []URL
	MaxDynamicURLs int
	CacheSeconds   int
}

HandlerOptions configures a generated sitemap handler.

type Provider

type Provider func(context.Context) ([]URL, error)

Provider supplies request-time sitemap URLs owned by application code.

type URL

type URL struct {
	Loc        string
	LastMod    string
	ChangeFreq string
	Priority   string
}

URL describes one sitemap URL. Loc may be absolute or root-relative before normalization.

Jump to

Keyboard shortcuts

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