Skip to content

docs: put the landing-page link in the book's sticky menu bar - #3

Merged
clhodapp merged 1 commit into
mainfrom
docs/site-link-in-menu-bar
Sep 1, 2026
Merged

clhodapp merged 1 commit into
mainfrom
docs/site-link-in-menu-bar

Conversation

@clhodapp

@clhodapp clhodapp commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Getting from https://nix-caisson.github.io/caisson/docs/ back to the landing page is still hard, despite the link added earlier.

Why the earlier fix did not work

The link lived in theme/header.hbs, which mdBook renders above its menu bar. That menu bar is position: sticky; top: 0 and stays pinned while you scroll; the header partial has no positioning, so it scrolls away as soon as you start reading. On any page long enough to be worth reading, the way back was off screen. The markup was on every page and the stylesheet loaded, so nothing looked broken from the outside; it just was not there when a reader wanted it.

What changed

The link moves into the menu bar's right-buttons group, beside the repository icon, which is where a reader looks for a way out of a book. It stays visible while reading. On screens narrower than 500px the word is hidden and the mark carries it, matching how mdBook treats its own buttons.

This requires overriding theme/index.hbs rather than only supplying a partial, which the earlier change deliberately avoided to keep the override small. That tradeoff was wrong: an override that does not work is not smaller. theme/header.hbs is deleted.

Verification

mdbook build succeeds and the link renders on all 18 reader-facing pages, inside the sticky menu bar element rather than above it, with href resolving to ../ at the book root and ../../ one level down. The styling uses mdBook's own --icons and --menu-bar-height variables, so it follows the theme in both light and navy.

The header partial rendered above mdBook's menu bar, which is
`position: sticky; top: 0`. The partial is not, so on any page long
enough to read, the way back scrolled out of view immediately and the
docs were still a dead end going up.

Move the link into the menu bar's right-buttons group, beside the
repository icon, where it stays on screen and reads as a way out of
the book. That means overriding index.hbs rather than only adding a
partial; a smaller override that does not work is not smaller.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@clhodapp clhodapp self-assigned this Sep 1, 2026
@clhodapp
clhodapp merged commit fe3c788 into main Sep 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant