Skip to content

feat(portal): add title anchors and content page table of contents#86

Draft
BatLeDev wants to merge 1 commit into
masterfrom
feat-content-page-toc
Draft

feat(portal): add title anchors and content page table of contents#86
BatLeDev wants to merge 1 commit into
masterfrom
feat-content-page-toc

Conversation

@BatLeDev

@BatLeDev BatLeDev commented Jun 26, 2026

Copy link
Copy Markdown
Member

Add title anchors and a content-page table of contents to the portal.

  • Opt-in anchor per title block (slug + optional table-of-contents label): setting a slug makes the title copiable and lists it in the page's table of contents
  • Copy-link affordance on hover with a native title attribute (RGAA); the URL hash is set on click and scrolled to on load (header offset handled via scroll-margin-top)
  • Table of contents: sticky aside top-right on lg+, collapses to a button + dropdown menu otherwise; hidden on full-width pages; shown only when at least one title is anchored
  • The table of contents (config._toc) is computed server-side from the anchored titles in document order, reusing the shared element traversal so titles nested in columns or catalog blocks are included
  • Long titles wrap instead of being truncated (portals_v1 regression)
  • API and e2e tests (slug validation + recursive collection of anchored titles, sidebar rendering, copy anchors)

Why: a standing TODO to let a title block carry an anchor and to display a navigable table of contents on content pages.

Heads-up:

  • layout-page.vue is a shared layout used by many pages — the table of contents renders only when at least one title is anchored, otherwise the layout is unchanged.
  • _toc is computed on create/patch only, so existing pages show no table of contents until their next edit + publish (the portal degrades gracefully via _toc ?? []). No backfill migration is included.

@github-actions github-actions Bot added feature and removed feature labels Jun 26, 2026
- title block: optional anchor (slug + table-of-contents label override)
- a defined slug makes the title copiable and lists it in the page sommaire
- copiable anchor on hover with native title (RGAA)
- URL hash set on click and scrolled-to on load (scroll-margin-top = header offset)
- sommaire: sticky aside on lg+, collapses to a button + menu otherwise
- sommaire hidden on full-width pages, shown only when a title is anchored
- long titles wrap instead of being truncated (portals_v1 regression)
- buildTocSections/slugifyAnchor utils with unit tests + e2e coverage
@BatLeDev BatLeDev force-pushed the feat-content-page-toc branch from d2c2b02 to 59ec325 Compare June 26, 2026 13:08
@github-actions github-actions Bot added feature and removed feature labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant