Skip to content

Grouped category index pages with a Start here entry point - #545

Draft
zieka wants to merge 1 commit into
masterfrom
refactor/docs-category-index
Draft

Grouped category index pages with a Start here entry point#545
zieka wants to merge 1 commit into
masterfrom
refactor/docs-category-index

Conversation

@zieka

@zieka zieka commented Sep 4, 2026

Copy link
Copy Markdown
Member

Problem

  • A category index page and the section sidebar list the same destinations in the same viewport, and the index costs roughly four times the height to say it. /authoring-recipes ran 19 cards over 2544px — 3.2 screens — while the same 19 links sat in the sidebar, unscrolled, the whole way down.
  • The one thing the grid adds over the sidebar is a description, and -webkit-line-clamp: 2 cut 12 of 62 of them off mid-sentence. The deciding information was the hidden information.
  • Nothing conveys order. /authoring-recipes presents a strict five-step sequence — set up, choose a recipe type, write, test, ship — as 19 interchangeable tiles, with no entry point.
  • Three defects sat in the same components: a nested category card read "18 items" instead of its authored description, external links showed no outbound icon that the navbar and sidebar both show, and previous/next links were a 14px-tall tap target.

Objectives

  1. Stop the index restating the sidebar; make the page carry what the sidebar cannot.
  2. Show every description in full.
  3. Give each section an entry point and an order.
  4. Fix the three defects above.
Assumptions
  • Grouping metadata belongs in each document's sidebar_custom_props, not in sidebars.ts. The docs plugin reads front matter ahead of the sidebar item (props.js:26), and an automated job edits sidebars.ts on every release — a second copy of titles and descriptions there would drift.
  • A section that sets no metadata renders as one flat list. That is the intended default, not a gap.
  • Deriving a route as / + doc id is safe here specifically: routeBasePath is / and no document in a section overrides its slug. Two documents define a custom slug; one matches its id and the other is the landing page, which is in no section.
  • The sidebar is hidden by an attribute set on mount and removed on unmount, rather than matched against a route list, so client-side navigation to a document restores it.
  • A category description must be set on the category itself, not only inside link — the plugin drops link when it builds client props. That is the whole cause of "18 items".
Changes
  • (1,2,3) src/theme/DocCategoryGeneratedIndexPage/ — new swizzle rendering a grouped description list instead of DocCardList: a Start here block, h2 group headings, and one row per document with its full, unclamped description.
  • (1) src/css/custom.css — hides the sidebar while an index page is mounted, and lifts the calc(100% - var(--doc-sidebar-width)) cap that would otherwise leave the reserved column as dead space. Removes five superseded generatedIndexPage rules.
  • (3) 48 documents — sidebar_custom_props carrying group and startHere. Content untouched; front matter only.
  • (4) sidebars.ts — category-level description for Popular recipe guides, and customProps on the external workshop link, which cannot carry front matter.

No tests: this repo has no test framework or test files. tsc and the production build are the available checks.

Notes
  • The height saving is smaller than removing cards suggests, and that is the point. /authoring-recipes 2544→2028px, /concepts 2060→1709, /reference 1968→1582, /running-recipes 1412→912. Un-clamping the descriptions spends some of the saving back; the result is ~20% shorter with complete information, not 70% shorter with it still hidden.
  • The tap-target fix is a regression repair. Previous/next were made deliberately subtle in a previous PR, and padding: 0 with line-height: 1 left a 14px hit area, under WCAG 2.2 §2.5.8. Rows here are ≥73px.
  • Swizzled rather than converted to MDX. Converting these five pages to hand-written MDX was the obvious route to h2 headings, but it copies every title and description out of sidebars.ts into a second source that an automated job would drift from.
  • Verified: yarn typecheck clean; production build succeeds; across five index pages — 0 clamped descriptions, 0 rows under 44px, 0 truncation; contrast passes AA in both themes (worst 4.83 light, 5.95 dark); reflows at 600px.
  • Composes with what is already on master. /reference/all-recipes resolves to Lists with its own sidebar, /reference/faq to Reference, and the index-page attribute releases correctly on document pages — the two mechanisms both touch sidebar visibility.

Replaces the DocCardList grid on generated-index pages with a grouped
description list. The grid restated the section sidebar at roughly four times
the height — /authoring-recipes ran 19 cards over 2544px while the same 19
links sat unscrolled in the sidebar — and its one addition, the description,
was clamped to two lines on 12 of 62 cards.

Grouping and the entry point come from sidebar_custom_props in each doc's
front matter, which the docs plugin reads ahead of the sidebar item, so
sidebars.ts stays the single source of truth. A section that sets neither
renders as one flat list.

The sidebar is hidden while an index page is mounted: the page is that list,
grouped and described, so showing both repeats every destination in one
viewport. The attribute is removed on unmount so client-side navigation to a
doc restores it.

Also fixes three defects:
- nested category cards fell back to "18 items" because the plugin drops
  `link` when building client props, so a description set only there never
  arrived
- external links in the index showed no outbound icon, unlike the same links
  in the navbar and sidebar
- previous/next links were a 14px-tall tap target, under WCAG 2.2 2.5.8

Heights: /authoring-recipes 2544->2028px, /concepts 2060->1709,
/reference 1968->1582, /running-recipes 1412->912. Zero clamped descriptions,
zero rows under 44px, AA in both themes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant