Documentation
¶
Overview ¶
Package navigation builds sidebar nav trees, breadcrumbs, and prev/next links for docs-layout collections.
Sidebar strategy dispatch moved from internal/sidebar.
Index ¶
- func BuildBreadcrumbs(page *engine.Page, collection *engine.Collection) []engine.BreadcrumbItem
- func BuildBreadcrumbsTabbed(page *engine.Page, col *engine.Collection, tab *engine.DocsTab) []engine.BreadcrumbItem
- func BuildBreadcrumbsVersioned(page *engine.Page, col *engine.Collection) []engine.BreadcrumbItem
- func BuildGlobalNav(site *engine.SiteContext, currentCollection *engine.Collection, ...) *engine.GlobalNav
- func BuildNavTree(collection *engine.Collection) *engine.NavTree
- func BuildNavTreeFromYAML(yamlPath string, collection *engine.Collection) (*engine.NavTree, error)
- func MarkActive(tree *engine.NavTree, currentPage *engine.Page) *engine.NavTree
- func WirePrevNextFromTree(tree *engine.NavTree)
- type DefaultSidebarStrategy
- type DocsSidebarStrategy
- type SidebarResult
- type SidebarStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBreadcrumbs ¶
func BuildBreadcrumbs(page *engine.Page, collection *engine.Collection) []engine.BreadcrumbItem
BuildBreadcrumbs constructs a breadcrumb trail for a docs-layout page. The trail starts with the collection root and ends with the current page.
func BuildBreadcrumbsTabbed ¶
func BuildBreadcrumbsTabbed(page *engine.Page, col *engine.Collection, tab *engine.DocsTab) []engine.BreadcrumbItem
BuildBreadcrumbsTabbed constructs breadcrumbs for a tabbed docs page. Adds the tab as a level between the collection root and section chain.
func BuildBreadcrumbsVersioned ¶
func BuildBreadcrumbsVersioned(page *engine.Page, col *engine.Collection) []engine.BreadcrumbItem
BuildBreadcrumbsVersioned constructs breadcrumbs for a versioned docs page. Inserts the version label between the collection root and the section chain.
func BuildGlobalNav ¶
func BuildGlobalNav(site *engine.SiteContext, currentCollection *engine.Collection, headerLinks []config.NavLink) *engine.GlobalNav
BuildGlobalNav builds the top-level site navigation from collections and optional header links from the site config. Collection items are sorted alphabetically; header links are appended after collection items.
func BuildNavTree ¶
func BuildNavTree(collection *engine.Collection) *engine.NavTree
BuildNavTree constructs a NavTree from a collection's section tree. For docs-layout collections, this produces the sidebar navigation. The tree respects transparent sections (hoisted), non-rendering sections (group label only), hidden pages, and weight-based sorting.
func BuildNavTreeFromYAML ¶
BuildNavTreeFromYAML parses a nav.yaml file and constructs a NavTree. When nav.yaml exists, it completely replaces auto-generated navigation.
func MarkActive ¶
MarkActive deep-clones the NavTree and marks the active node and its ancestor chain for the current page. The clone ensures the shared collection-level NavTree is not mutated during parallel rendering.
func WirePrevNextFromTree ¶
WirePrevNextFromTree rewires Page.PrevPage/NextPage based on the nav tree's flattened DFS order. This replaces simple sort-order prev/next for docs-layout collections, enabling cross-section navigation.
Types ¶
type DefaultSidebarStrategy ¶
type DefaultSidebarStrategy struct{}
DefaultSidebarStrategy returns no sidebar for default-layout collections.
func (*DefaultSidebarStrategy) Build ¶
func (s *DefaultSidebarStrategy) Build(page *engine.Page, collection *engine.Collection) *SidebarResult
type DocsSidebarStrategy ¶
type DocsSidebarStrategy struct{}
DocsSidebarStrategy returns the collection's pre-built NavTree for docs-layout.
func (*DocsSidebarStrategy) Build ¶
func (s *DocsSidebarStrategy) Build(page *engine.Page, collection *engine.Collection) *SidebarResult
type SidebarResult ¶
type SidebarResult struct {
Enabled bool
Tree *engine.NavTree
Type string // "nav", "widget", "none"
}
SidebarResult holds the output of a sidebar strategy build.
type SidebarStrategy ¶
type SidebarStrategy interface {
Build(page *engine.Page, collection *engine.Collection) *SidebarResult
}
SidebarStrategy determines sidebar content for a given page/collection.
func GetStrategy ¶
func GetStrategy(layout engine.LayoutType) SidebarStrategy
GetStrategy returns the appropriate sidebar strategy for a layout type.