seo

package module
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: 5 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.

README

modules/seo

Official Lesstruct module: SEO metadata generation, sitemap and robots discovery surfaces, and legacy-URL aliases.

Layout (module template)

module.go            # kernel.Module + Migrator (single registry-facing file)
migrations/          # {sqlite,postgresql,mysql}/000001_aliases.{up,down}.sql (embed)
api/                 # sitemap/robots handlers, legacy envelope (3.4d)
domain/              # SEO metadata service (3.4b)
alias/               # alias entities, service, repository interfaces (3.4b)
seo/                 # meta/extraction helpers, Published Language (3.4b)
store/               # single-source alias repository on kernel.Dialect (3.4c)
admin/               # admin-shell manifest (empty: SEO renders data-driven)
testutil/            # kernel fixture for module tests

Migrations

Each module versions independently in its own schema_migrations_<module> table (see internal/database/modules.go), so modules install and upgrade without touching the core sequence. Module migrations must stay idempotent (CREATE TABLE IF NOT EXISTS): pre-module installs already carry tables extracted from the core sequence. The MySQL alias migration folds its indexes into the CREATE TABLE as KEY clauses — MySQL cannot re-apply separate CREATE INDEX statements, so the whole statement must no-op at once on upgrades.

Documentation

Overview

Package seo is the official SEO module: metadata generation, sitemap and robots discovery surfaces, and legacy-URL aliases.

Index

Constants

View Source
const (
	// Name is the registry key for this module.
	Name = "seo"

	// Version is the module version reported via Module.Version.
	Version = "0.1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module is the seo kernel module.

func New

func New(opts ...Option) *Module

New builds the module, adopting the composition root's wiring. The handler is built once here so routes serve the same instance.

func (*Module) AdminManifest

func (m *Module) AdminManifest() kernel.AdminExtensionManifest

AdminManifest declares this module's admin-shell extensions. SEO surfaces in the admin UI data-driven (the content editor's collapsible SEO settings read the content SEO API), so the module declares no menu entries, settings sections, or editor extensions.

func (*Module) Handler

func (m *Module) Handler() *api.SEOHandler

Handler exposes the discovery-surface handler for core mounting. Core mounts it explicitly (rather than via RouteProvider) because the three leaves live in three different middleware groups (root, /api, /api/v1), which a single RegisterRoutes call cannot express.

func (*Module) Init

func (m *Module) Init(_ kernel.Kernel) error

Init wires the module. Migration execution is core-driven (it needs the live *sql.DB, which modules never touch directly).

func (*Module) Migrations

func (m *Module) Migrations() fs.FS

Migrations returns the embedded migration filesystem, laid out per driver ({sqlite,postgresql,mysql}/NNN_name.{up,down}.sql). The core runner tracks each module in its own schema_migrations_<module> table.

func (*Module) Name

func (m *Module) Name() string

Name returns the registry key.

func (*Module) Optional

func (m *Module) Optional() []string

Optional lists soft dependencies. None.

func (*Module) Requires

func (m *Module) Requires() []string

Requires lists hard dependencies. Aliases reference content items loosely (content IDs without foreign-key enforcement), so nothing is required.

func (*Module) Shutdown

func (m *Module) Shutdown() error

Shutdown releases module resources. There are none beyond memory.

func (*Module) Version

func (m *Module) Version() string

Version returns the module version.

type Option

type Option func(*Module)

Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module that serves nothing (the handler built over a nil pages source must not be invoked).

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL attaches the canonical site URL for absolute sitemap URLs. A trailing slash is trimmed at handler construction.

func WithHeadless

func WithHeadless(headless bool) Option

WithHeadless disables the XML sitemap (no server-rendered site exists to advertise) and blocks all crawling in robots.txt.

func WithLogger

func WithLogger(logger kernel.Logger) Option

WithLogger attaches the module logger. Without one handler failures are dropped (discard sink).

func WithPages

func WithPages(pages api.PublishedPages) Option

WithPages attaches the published-content source for sitemap generation.

Directories

Path Synopsis
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for SEO.
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for SEO.
Package store is the single-source alias repository: one implementation against *sql.DB plus a kernel Dialect, replacing the three per-driver copies.
Package store is the single-source alias repository: one implementation against *sql.DB plus a kernel Dialect, replacing the three per-driver copies.
Package testutil provides the kernel fixture module tests run against.
Package testutil provides the kernel fixture module tests run against.

Jump to

Keyboard shortcuts

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