You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(shell): two homes — masthead follows brand_href, opt-in app_link topbar link
## Summary
DocsUI::Page's masthead "← Home" hardcoded the host's `root_path` helper — on
an app-embedded docs site that's the application root (in Zazu, the
authenticated dashboard), so anonymous readers were bounced off the docs and
sites had to patch the route helper (getzazu/app#3193). The masthead now
follows `config.brand_href` (the DOCS home, same as the topbar/sidebar brand
links), relabeled "← Docs home". A new opt-in `c.app_link = { href:, label: }`
(default nil → absent) renders the way BACK to the hosting app once, in the
topbar right after the brand; external hrefs open in a new tab with
rel=noopener, mirroring TopbarLinks.
## Test Coverage
- configuration_spec: app_link defaults nil; Hash (symbol/string keys)
normalizes to DocsKit::TopbarLink; TopbarLink passes through
- shell_spec: unset → topbar unchanged; set → labeled anchor after the brand;
external → target=_blank + noopener; relative → neither
- page_spec: #home_href defaults "/" and follows c.brand_href (child-process
harness — Page can't load in the Rails-free suite)
- install_generator_spec: the generated initializer documents the commented
c.app_link example
## Verification
- [x] bundle exec rubocop passes
- [x] bundle exec rspec passes (795 examples, 94.87% line coverage)
Refs #62
@@ -181,13 +185,15 @@ registry maps a heading to its authored pages (`Doc.nav_items`); a page that
181
185
isn't written yet is skipped, so there are no dead links. Register a page with
182
186
one line (see [Add a page](#add-a-page)) and it appears in the sidebar.
183
187
184
-
### Brand link and dark code themes
188
+
### The two homes, the brand link, and dark code themes
185
189
186
-
Three knobs cover what sites used to shim by subclassing `DocsUI::Shell`:
190
+
These knobs cover what sites used to shim by subclassing `DocsUI::Shell` or
191
+
overriding route helpers:
187
192
188
193
| Knob | Default | What it does |
189
194
|------|---------|--------------|
190
-
|`c.brand_href`|`"/"`| The href of the topbar brand link. Set it (e.g. `"/docs"`) instead of subclassing `Shell` to copy-paste `#topbar`. |
195
+
|`c.brand_href`|`"/"`| The **docs home** — the href of the topbar brand, the sidebar brand, and each page's "← Docs home" masthead link. Set it (e.g. `"/docs"`) when the docs live under a subpath, instead of subclassing `Shell` or overriding `root_path`. |
196
+
|`c.app_link`|`nil`| The **app home** — an opt-in `{ href:, label: }` link back to the application hosting the docs, rendered once in the topbar right after the brand (e.g. `{ href: "/", label: "Back to Zazu" }`). Unset renders nothing, so a standalone docs site is unchanged. External hrefs open in a new tab with `rel=noopener`. |
191
197
|`c.code_theme_dark`|`nil`| A second Rouge theme for **dark** daisyUI themes. `nil` keeps the single-theme behavior (fully backwards compatible). When set, `DocsUI::Code` also emits this theme's CSS scoped under `[data-theme=X] .code-highlight` for each shipped dark theme, so code blocks stay readable when the switcher flips to a dark theme. |
192
198
|`c.dark_themes`| daisyUI's built-in dark theme names | Which theme names count as dark for `code_theme_dark`. Intersected with `c.themes` at render time, so only shipped themes emit CSS. Override to name custom dark themes (e.g. `%w[zazu-dark]`). |
0 commit comments