nav

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 9 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

Overview

Package nav builds the navigation tree that mirrors contentDir.

The tree is built once per build and never modified after. Per-page views with Active/InPath flags are made by ForPage, which copies only the nodes on the path to the page and shares the rest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TitleCase

func TitleCase(s string) string

TitleCase turns a folder name like "user-guide" into "User Guide".

func Walk

func Walk(root *Node) []string

Walk returns the URLs of all pages in depth-first order: a section's own page comes before its children. Prev/next links follow it.

Types

type Node

type Node = plugin.NavNode

Node is one entry in the navigation tree.

func Build

func Build(pages []*content.Page, siteTitle string) *Node

Build creates the tree for pages. siteTitle labels the root when there is no root index page.

func ForPage

func ForPage(root *Node, url string) *Node

ForPage returns a view of root with Active set on the node for url and InPath on it and its ancestors. Nodes off that path are shared with root. If url is not in the tree, root is returned unchanged.

Jump to

Keyboard shortcuts

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