Documentation
¶
Index ¶
- type AssetSet
- type BuildStats
- type Hooks
- type NavItem
- type Renderer
- func (r *Renderer) Build(ctx context.Context, graph *content.SiteGraph) error
- func (r *Renderer) BuildTaxonomyArchives(ctx context.Context, graph *content.SiteGraph) error
- func (r *Renderer) BuildURLs(ctx context.Context, graph *content.SiteGraph, urls []string) error
- func (r *Renderer) BuildWithStats(ctx context.Context, graph *content.SiteGraph) (BuildStats, error)
- func (r *Renderer) RenderNotFoundPage(graph *content.SiteGraph, requestPath string, liveReload bool) ([]byte, error)
- func (r *Renderer) RenderURL(graph *content.SiteGraph, urlPath string, liveReload bool) ([]byte, error)
- func (r *Renderer) RenderURLWithQuery(graph *content.SiteGraph, urlPath string, rawQuery string, liveReload bool) ([]byte, error)
- type ScriptPosition
- type Slots
- type ViewData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetSet ¶
type AssetSet struct {
// contains filtered or unexported fields
}
AssetSet accumulates CSS and JS assets for a single render pass.
Asset hooks append to the set, and the renderer publishes them into standard theme slots such as head.end and body.end.
func NewAssetSet ¶
func NewAssetSet() *AssetSet
NewAssetSet creates an empty asset accumulator for a render pass.
func (*AssetSet) AddScript ¶
func (a *AssetSet) AddScript(url string, pos ScriptPosition)
func (*AssetSet) RenderInto ¶
type BuildStats ¶
type BuildStats struct {
Prepare time.Duration
Assets time.Duration
Documents time.Duration
Taxonomies time.Duration
Search time.Duration
}
BuildStats records coarse timing breakdowns for a render/build pass.
type Hooks ¶
type Hooks interface {
OnContext(*ViewData) error
OnAssets(*ViewData, *AssetSet) error
OnBeforeRender(*ViewData) error
OnAfterRender(url string, html []byte) ([]byte, error)
OnAssetsBuilding(*config.Config) error
OnHTMLSlots(*ViewData, *Slots) error
}
Hooks lets plugins participate in the render pipeline.
The hook order for a single page render is:
- OnContext
- OnAssets
- OnHTMLSlots
- OnBeforeRender
- >> template execution
- OnAfterRender
Implementations should keep work fast and deterministic because these hooks run for every rendered output.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer turns the site graph into HTML output using the active frontend theme and the provided render hooks.
func (*Renderer) BuildTaxonomyArchives ¶
func (*Renderer) BuildWithStats ¶
func (*Renderer) RenderNotFoundPage ¶
type ScriptPosition ¶
type ScriptPosition string
ScriptPosition controls where a script asset is rendered in theme slots.
const ( ScriptPositionHead ScriptPosition = "head" ScriptPositionBodyEnd ScriptPosition = "body.end" )
type Slots ¶
type Slots struct {
// contains filtered or unexported fields
}
Slots collects named HTML fragments that themes expose via pluginSlot in templates.
Asset hooks and HTML slot hooks populate Slots before template execution.
func NewSlots ¶
func NewSlots() *Slots
NewSlots creates an empty slot registry for a single render pass.
type ViewData ¶
type ViewData struct {
Site *config.Config
Page *content.Document
Documents []*content.Document
Data map[string]any
Lang string
Title string
LiveReload bool
TaxonomyName string
TaxonomyTerm string
AuthorName string
SearchQuery string
RequestPath string
StatusCode int
}
ViewData is the template context passed to frontend theme layouts.
Theme authors can rely on these fields in templates, and render hooks may enrich or modify them before execution.