feat: blog post table of contents (desktop sidebar + mobile bottom sheet) #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/blog-post-toc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a table of contents to blog post pages.
What
$ fortunequote on post pages), h2 + h3, with a scroll-driven highlight of the section you're currently reading.## …), tap to expand the full list over a backdrop, tap a heading / backdrop / Esc to close. Body scroll locks while open.How
src/lib/toc.ts(filterHeadings,activeHeadingId) — 10 unit tests.TableOfContents.astro(sidebar + mobile variants) →TocList.astro(shared list) andTocBottomSheet.astro(mobile sheet).Layout.astroexposes a namedsidebarslot (falls back to the fortune quote) and a body-leveloverlayslot for the fixed sheet.Notable fixes found in manual + headless-browser testing
items-start; stretched the aside column.position: fixedanchored to the.revealsection (its load animation leaves a transform → containing block). Moved the sheet to a body-level overlay slot, outside the transformed subtree. Verified via headless CDP that it pins to the viewport.89 tests pass;
astro buildclean (48 pages).