site

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 6 Imported by: 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles multi-page site discovery and navigation

func New

func New(rootDir string, cfg *config.Config) *Manager

New creates a new site manager

func (*Manager) AllPages

func (m *Manager) AllPages() []*PageNode

AllPages returns all pages (flat list)

func (*Manager) Discover

func (m *Manager) Discover() error

Discover scans the directory and builds the site structure

func (*Manager) GenerateSearchIndex

func (m *Manager) GenerateSearchIndex() []SearchEntry

GenerateSearchIndex creates a search index from all pages

func (*Manager) GetBreadcrumbs

func (m *Manager) GetBreadcrumbs(urlPath string) []*PageNode

GetBreadcrumbs returns the breadcrumb trail for a given path

func (*Manager) GetHome

func (m *Manager) GetHome() *PageNode

GetHome returns the home page

func (*Manager) GetNavigation

func (m *Manager) GetNavigation() []*PageNode

GetNavigation returns the navigation tree

func (*Manager) GetPage

func (m *Manager) GetPage(urlPath string) (*PageNode, bool)

GetPage returns a page by its URL path

func (*Manager) GetPrevNext

func (m *Manager) GetPrevNext(currentPath string) (prev, next *PageNode)

GetPrevNext returns the previous and next pages for navigation

func (*Manager) Reload

func (m *Manager) Reload(filePath string) error

Reload reloads a specific file (for hot reload)

func (*Manager) ResolveBreadcrumbHref added in v0.3.9

func (m *Manager) ResolveBreadcrumbHref(path string) (string, bool)

ResolveBreadcrumbHref maps a breadcrumb crumb's stored path to a servable URL. Section/group crumbs carry a directory-style path (e.g. "/recipes") that is not itself a route: index pages register with a trailing slash ("/recipes/"), and some sections have no index page at all. It returns the path unchanged when a page is registered there, falls back to the index route (path + "/") when only that exists, and reports ok=false when nothing is servable — so the caller can render a plain label instead of a link that would 303-redirect back to the home page.

type PageNode

type PageNode struct {
	Title     string           // Page title from frontmatter or config
	Path      string           // URL path (e.g., "/getting-started/installation")
	FilePath  string           // Relative file path (e.g., "getting-started/installation.md")
	Page      *tinkerdown.Page // Parsed page content
	IsHome    bool             // Whether this is the home page
	Collapsed bool             // For sections/groups: whether collapsed by default
	Children  []*PageNode      // Child pages (for sections and groups)
}

PageNode represents a page in the site structure

func (*PageNode) ContainsPath added in v0.3.8

func (n *PageNode) ContainsPath(urlPath string) bool

ContainsPath reports whether this node or any descendant has the given URL path. Used to keep a collapsed section/group open when it holds the active page, and to resolve a nested page's section in the search index.

type SearchEntry

type SearchEntry struct {
	Title   string `json:"title"`
	Path    string `json:"path"`
	Content string `json:"content"`
	Section string `json:"section,omitempty"`
}

SearchEntry represents a single entry in the search index

Jump to

Keyboard shortcuts

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