navigation

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package navigation builds sidebar nav trees, breadcrumbs, and prev/next links for docs-layout collections.

Index

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

func BuildNavTreeFromYAML(yamlPath string, collection *engine.Collection) (*engine.NavTree, error)

BuildNavTreeFromYAML parses a nav.yaml file and constructs a NavTree. When nav.yaml exists, it completely replaces auto-generated navigation.

func MarkActive

func MarkActive(tree *engine.NavTree, currentPage *engine.Page) *engine.NavTree

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

func WirePrevNextFromTree(tree *engine.NavTree)

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

This section is empty.

Jump to

Keyboard shortcuts

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