module

Hwaro::Content::Menus

Class methods

build(config : Models::Config, pages : Array(Models::Page), sections : Array(Models::Section), version : Models::VersionConfig | Nil = nil) : Hash(String, Hash(String, Array(Entry)))

Builds the full set of menu trees for every language the site declares (the default language plus every [languages.*] key).

Deterministic by construction: config entries keep their file declaration order, front-matter registrations are folded in path-sorted order, and assemble_tree sorts every level by {weight, name, identifier}.

version scopes front-matter registrations on a versioned site ([[versions.list]]): entries from unversioned pages always appear; entries from versioned pages appear only in that version's menus (version = that version) — and, for the unversioned menus (version = nil), only the LATEST version's entries do, so a site nav registered from docs/v2/_index.md shows up on the homepage without its v1 twin next to it. Config [[menus.*]] entries are static URLs and appear everywhere.

Source
top_level_dir(dir : String, version : Models::VersionConfig | Nil) : String | Nil

The top-level directory dir (a section's content directory) stands for, or nil for the root and nested sections. A versioned section is read through its version root, as visitors see it: docs/v2 → docs, v2 → the root (nil), v2/guide → guide. Shared by the menu build, the serve menu fingerprint and doctor.

Source

Nested types