document

package
v0.1.0-alpha.40 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package document renders the complete SEO and hydration document around a body produced by GoBeyond's portable renderer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(writer io.Writer, input Input) error

Types

type Asset

type Asset struct {
	URL       string
	Integrity string
}

type BodyHTML

type BodyHTML string

type HydrationData

type HydrationData struct {
	APIVersion string `json:"apiVersion"`
	BuildID    string `json:"buildId"`
	RouteID    string `json:"routeId"`
	Props      any    `json:"props"`
	// RenderNow is the UTC RFC3339Nano instant used for render-snapshot Date
	// projections in the Go plan. The browser must use this same instant on
	// first paint (via Vite rewrites), not new Date() at hydrate time.
	RenderNow string `json:"renderNow,omitempty"`
	// RenderLocale is the document language used for first paint. Locale-sensitive
	// strings (Intl.DateTimeFormat, etc.) are not portable Date intrinsics —
	// format them in the Go loader and pass as props. This field documents the
	// server locale for diagnostics and future Intl work.
	RenderLocale string `json:"renderLocale,omitempty"`
}

type Input

type Input struct {
	PublicOrigin   string
	Indexable      bool
	Metadata       gb.Metadata
	Body           BodyHTML
	Hydration      HydrationData
	Styles         []Asset
	ModulePreloads []Asset
	Scripts        []Asset
	Nonce          string
}

Jump to

Keyboard shortcuts

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