pub fn replace_site_nav(
html: &str,
nav: &[NavEntry],
current_href: &str,
) -> Option<String>Expand description
Replace the <nav class="sitenav">…</nav> block in a hand-written page
with the bar the renderer computes, returning None when the page carries no
such block.
§Why this exists
website/public/index.html is the one page of roteiro.dev nothing renders —
it is copied verbatim — and it used to carry a hand-maintained copy of the
list the renderer derives from site-order (issue #508). Adding
docs/SERVING.md appeared in every rendered page’s bar automatically and had
to be typed into the landing page by hand.
The failure that made it worth removing rather than remembering is silent and
points the wrong way: a new page is published, reachable, and linked from
every page except the front one. Nothing errors and roteiro check
passes, because everything that is there resolves.
That is also why no link auditor could have caught it, and why none will
catch the next one of its shape. The defect is a link that does not
exist; auditing what is there cannot find what is missing. This removes the
possibility instead — after this, the landing page has no independent list to
disagree with. What still guards the seam is
the_landing_page_carries_the_bar_the_renderer_emits, which now checks that
the replacement happened: a landing page whose marker was renamed away
keeps its stale bar silently, and that test is what fails.
§Why None rather than an error
A landing page with no sitenav is not claiming a bar, and a site is allowed
not to have one — every render docs fixture writes a one-line index.html.
The caller leaves such a page alone.