render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetRefs

type AssetRefs struct {
	CSS        string
	JSHead     string
	JS         string
	FlexSearch string
	KaTeX      string
	Extra      map[string]string // original basename → fingerprinted URL
}

AssetRefs holds fingerprinted asset URLs.

type Renderer

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

Renderer handles template rendering.

func New

func New(site *SiteData, assets AssetRefs, layoutsDir string, liveReload bool) *Renderer

New creates a new Renderer.

func (*Renderer) InvalidateCache

func (r *Renderer) InvalidateCache()

InvalidateCache clears the template cache (useful after layout file changes).

func (*Renderer) Render404

func (r *Renderer) Render404(outputDir string, allPages []*content.Page) error

Render404 renders a 404.html page to outputDir/404.html.

func (*Renderer) RenderPage

func (r *Renderer) RenderPage(page *content.Page, allPages []*content.Page) error

RenderPage renders a single page to its OutputPath.

func (*Renderer) RenderSearchPage

func (r *Renderer) RenderSearchPage(outputDir string) error

RenderSearchPage renders the /search/ page.

func (*Renderer) RenderTagPage

func (r *Renderer) RenderTagPage(tag string, pages []*content.Page, outputDir string) error

RenderTagPage renders a tag term page.

func (*Renderer) RenderTaxonomyPage

func (r *Renderer) RenderTaxonomyPage(tags []TagCount, outputDir string) error

RenderTaxonomyPage renders the /tags/ overview page.

type SidebarItem

type SidebarItem struct {
	Title     string
	URL       string
	Active    bool
	HasActive bool
	IsParent  bool
	Children  []*SidebarItem
}

SidebarItem is a pre-built sidebar navigation node.

type SiteData

type SiteData struct {
	Title       string
	BaseURL     string
	Description string
	EditURLBase string
}

SiteData holds site-wide metadata available to all templates.

type TagCount

type TagCount struct {
	Name  string
	Count int
}

TagCount holds a tag and its page count.

type TemplateData

type TemplateData struct {
	Page             *content.Page
	Site             *SiteData
	Assets           AssetRefs
	Pages            []*content.Page // for list pages: children or tag members
	Tags             []TagCount      // for taxonomy page
	GraphDataJSON    string          // JSON string, embedded inline for type=graph
	TreeDataJSON     string          // JSON string, embedded inline for type=tree
	CalendarDataJSON string          // JSON string, embedded inline for type=calendar
	SidebarItems     []*SidebarItem  // pre-built sidebar nav tree
	SidebarRoot      *content.Page   // page whose subtree is shown in sidebar
	SidebarBack      *content.Page   // back-link target (nil = no back link)
	PrevPage         *content.Page   // previous sibling (for pager)
	NextPage         *content.Page   // next sibling (for pager)
}

TemplateData is the data passed to all templates.

Jump to

Keyboard shortcuts

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