Skip to main content

render_nav

Function render_nav 

Source
pub fn render_nav(nav: &[NavEntry], current_href: &str, root: &str) -> String
Expand description

The site navigation bar: one link per page, the current one marked.

Plain anchors in a <nav>, styled by website/public/style.css. No script: the explorer is deliberately vendored with no build step (ADR-0010), and a navigation bar that needs JavaScript to be a navigation bar would be the first thing on this site that does. root is the climb from the page being rendered back to the site root: "" for a root-level page, "../" for one a directory down. Nav hrefs are stored root-relative, so a nested page has to prefix them or every entry resolves beside the page rather than beside the root.