api

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 9 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageRef

type PageRef struct {
	ID                 int
	Slug               string
	PostType           string
	Language           string
	TranslationGroupID *int
	UpdatedAt          time.Time
}

PageRef is the sitemap-relevant projection of a published content item: its identity for translation grouping, its slug and type for filtering, and its timestamps for freshness. Core projects content items into it so this package never imports the content domain.

type PublishedPages

type PublishedPages func(ctx context.Context, limit, offset int) ([]PageRef, error)

PublishedPages lists published content for sitemap generation. Core satisfies it with a closure over the content service (which cannot be imported here); tests stub it with a func literal.

type SEOHandler

type SEOHandler struct {
	// contains filtered or unexported fields
}

SEOHandler serves sitemap and robots discovery surfaces.

func NewSEOHandler

func NewSEOHandler(
	pages PublishedPages,
	baseURL string,
	headless bool,
	logger kernel.Logger,
) *SEOHandler

NewSEOHandler constructs an SEOHandler over the given published-pages source. A nil logger degrades to a discard sink so the handler is safe to construct in any context.

func (*SEOHandler) GetRobotsTxt

func (h *SEOHandler) GetRobotsTxt(w http.ResponseWriter, r *http.Request)

func (*SEOHandler) GetSitemapData

func (h *SEOHandler) GetSitemapData(w http.ResponseWriter, r *http.Request)

func (*SEOHandler) GetSitemapXML

func (h *SEOHandler) GetSitemapXML(w http.ResponseWriter, r *http.Request)

GetSitemapXML serves the sitemaps.org XML document crawlers expect at /sitemap.xml (the path robots.txt advertises). The JSON shape served at /api/v1/sitemap is for programmatic callers; crawlers need XML. In headless mode there is no server-rendered content site, so every /<slug> URL would 404 — the XML sitemap is disabled (404) rather than advertising dead URLs.

Jump to

Keyboard shortcuts

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