Documentation
¶
Overview ¶
Package server provides infrastructure initialization.
Package server provides the HTTP server and routing configuration.
Package server — CMS core route mounts.
This file holds the route mounters for what Hatamoto considers the "CMS core": entity / schema / media / forms / menus / redirects / public site rendering / auth + user management / taxonomy / analytics admin / linking / 404 monitor / API keys.
Package server — plugin extension point for the public sitemap.
Core derives its own groups from the schema URL settings (sitemap_builder.go). Plugins that re-add a content type with its own archive listing (e.g. case-study, playbook) register an archive group via RegisterArchiveGroup, and plugins that own a standalone funnel page register it via RegisterStaticSitemapRoute — both from their Wire(), which runs at boot before any request is served.
Index ¶
- func NewCountingHandler(inner slog.Handler) slog.Handler
- func RegisterArchiveGroup(groupKey string, cfg ArchiveGroupConfig)
- func RegisterStaticSitemapRoute(e SitemapEntry)
- func RenderErrorCount() int64
- func RouteTable() (table []httpx.Route, err error)
- func UpdatePlugins(pk *packages.Store) updater.PluginSource
- type ArchiveGroupConfig
- type BreadcrumbItem
- type ContentSegmentResponse
- type HrefLang
- type Infrastructure
- type NavigationItem
- type PageMeta
- type PublicPageResponse
- type Server
- type SitemapEntry
- type SitemapIndex
- type SitemapIndexEntry
- type URL
- type URLSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCountingHandler ¶
NewCountingHandler wraps inner and counts the records RenderErrorCount reports.
func RegisterArchiveGroup ¶
func RegisterArchiveGroup(groupKey string, cfg ArchiveGroupConfig)
RegisterArchiveGroup installs a plugin-owned sitemap archive group. The group is merged with the groups derived from schema settings when the sitemap is built; re-registering a key replaces its configuration.
func RegisterStaticSitemapRoute ¶
func RegisterStaticSitemapRoute(e SitemapEntry)
RegisterStaticSitemapRoute installs a plugin-owned static URL into the "misc" sub-sitemap.
func RenderErrorCount ¶
func RenderErrorCount() int64
RenderErrorCount is the render errors smoke requests have caused so far.
func RouteTable ¶
RouteTable returns every route the core registers (method, path, handler) for `hatamoto routes` and the route-table test. It builds the routes on a Server with just enough non-nil collaborators and no database, so plugin routes (which live on per-plugin muxes behind fixed catch-alls) are not listed: `hatamoto routes` prints that note.
func UpdatePlugins ¶
func UpdatePlugins(pk *packages.Store) updater.PluginSource
UpdatePlugins is the preflight's view of the installed packages, for the command line as well as the server.
Types ¶
type ArchiveGroupConfig ¶
ArchiveGroupConfig describes a plugin-owned sitemap group.
type BreadcrumbItem ¶
BreadcrumbItem represents a breadcrumb navigation item.
type ContentSegmentResponse ¶
type ContentSegmentResponse struct {
SegmentIndex int `json:"segment_index"`
SegmentType string `json:"segment_type"`
Heading string `json:"heading,omitempty"`
ContentText string `json:"content_text"`
ContentHTML string `json:"content_html,omitempty"`
TopicLabels []string `json:"topic_labels,omitempty"`
IsAnswerCandidate bool `json:"is_answer_candidate"`
WordCount int `json:"word_count"`
}
ContentSegmentResponse represents a content segment in the public API.
type HrefLang ¶
type HrefLang struct {
Rel string `xml:"rel,attr"`
HrefLang string `xml:"hreflang,attr"`
Href string `xml:"href,attr"`
}
HrefLang represents an xhtml:link alternate element (added by plugin filters).
type Infrastructure ¶
type Infrastructure struct {
Cache *cache.Cache
CacheInvalidator *cache.CacheInvalidator
}
Infrastructure holds the in-process cache components.
func NewInfrastructure ¶
func NewInfrastructure(logger *slog.Logger) *Infrastructure
NewInfrastructure builds the in-process cache and its invalidator.
func (*Infrastructure) Shutdown ¶
func (i *Infrastructure) Shutdown() error
Shutdown releases infrastructure components. The in-process cache needs no teardown.
type PageMeta ¶
type PageMeta struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
OGImage string `json:"og_image,omitempty"`
CanonicalURL string `json:"canonical_url,omitempty"`
NoIndex bool `json:"no_index,omitempty"`
}
PageMeta represents SEO metadata for a page.
type PublicPageResponse ¶
type PublicPageResponse struct {
Entity *entity.Entity `json:"entity"`
JSONLD map[string]interface{} `json:"json_ld,omitempty"`
Meta PageMeta `json:"meta"`
Breadcrumb []BreadcrumbItem `json:"breadcrumb"`
Editorial json.RawMessage `json:"editorial,omitempty"`
Segments []ContentSegmentResponse `json:"segments,omitempty"`
// AICrawlerComment is the HTML comment block embedded in the page for
// AI/LLM crawlers. Empty when the entity has been opted out via the
// SEO tab's "Include in /llms.txt" toggle.
AICrawlerComment string `json:"ai_crawler_comment,omitempty"`
}
PublicPageResponse represents a public page API response.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server.
func (*Server) Handler ¶
Handler is the fully wired HTTP handler (site, API, MCP), for callers that drive the server without listening (tests).
func (*Server) SetBackups ¶
SetBackups hands the server the backup engine and the admin its service. The routes are mounted in New, before the engine exists; call it before the server starts serving.
func (*Server) SetStats ¶ added in v1.0.2
func (s *Server) SetStats(svc *installstats.Service)
SetStats hands the install stats service to the server. Call it before Start. HATAMOTO_TELEMETRY=off is applied here, once, even when the worker is off, so a stored install ID is deleted at boot. The daily job is scheduled when the worker is on.
func (*Server) SetUpdater ¶
SetUpdater builds the update agent from env, adding what only the server knows (installed packages, site timezone), and puts its periodic check on the worker scheduler. Call it before Start. With the worker off, or the job disabled by WORKER_DISABLE_JOBS, nothing is scheduled; the agent is built anyway so a bad update URL is reported at boot.
type SitemapEntry ¶
SitemapEntry is a plugin-owned static URL for the misc sitemap.
type SitemapIndex ¶
type SitemapIndex struct {
XMLName xml.Name `xml:"sitemapindex"`
XMLNS string `xml:"xmlns,attr"`
Sitemaps []SitemapIndexEntry `xml:"sitemap"`
}
SitemapIndex represents an XML sitemap index (container for sub-sitemaps).
type SitemapIndexEntry ¶
SitemapIndexEntry represents a single sub-sitemap reference in the index.
Source Files
¶
- adapters.go
- admin_audit.go
- admin_backups.go
- admin_content.go
- admin_email.go
- admin_growth_mount.go
- admin_import_mount.go
- admin_mount.go
- admin_packages.go
- admin_spam.go
- admin_updates.go
- admin_webhooks.go
- adminaddr_intercept.go
- adminaddr_seam.go
- adminaddr_site.go
- agent_logs.go
- agent_resolver.go
- author_name.go
- content_epoch.go
- demo.go
- email_converge.go
- email_resolver.go
- entity_handlers.go
- entity_live.go
- entity_moves.go
- fault_default.go
- feeds.go
- form_confirmation_throttle.go
- form_handlers.go
- form_post_handlers.go
- handlers.go
- handlers_api_keys.go
- infrastructure.go
- knowledge_graph_handlers.go
- legacy_cookies.go
- linking_v2_handlers.go
- mcp.go
- mcp_builder.go
- media_handlers.go
- menu_handlers.go
- notfound_probe.go
- notfound_responder.go
- notfound_throttle.go
- notfound_wellknown.go
- packages.go
- page_cache_runtime.go
- page_cache_service.go
- page_preload.go
- plugin_capabilities.go
- plugins.go
- plugins_admin_handlers.go
- plugins_settings_handlers.go
- public_cors.go
- public_handlers.go
- public_meta.go
- public_pages_loader.go
- public_resolve.go
- public_resolve_loader.go
- qa_off.go
- redirect_explain.go
- redirect_handlers.go
- registry_directory.go
- render_admin_handlers.go
- render_agent_capture.go
- render_ai_referral.go
- render_data.go
- render_handlers.go
- render_hooks.go
- render_links.go
- render_listing.go
- render_nodes.go
- render_page_filter.go
- render_preview_override.go
- render_refs.go
- render_related.go
- render_root_handlers.go
- render_series.go
- render_view.go
- routes_table.go
- schema_pattern_moves.go
- section_template_handlers.go
- server.go
- server_core.go
- site_name.go
- site_settings_handlers.go
- sitemap_builder.go
- sitemap_filter.go
- sitemap_hooks.go
- smoke_counter.go
- smoke_listener.go
- smtp_warning.go
- stats_wiring.go
- theme_preview.go
- theme_validation.go
- updater_wiring.go
- url_helpers.go
- webhooks_legacy.go
- webhooks_wiring.go
- worker_jobs.go