Add auto-generated table of contents to blog posts - #13881
Open
manuelzzz wants to merge 2 commits into
Open
Conversation
manuelzzz
requested review from
a team,
abdallahshaban557 and
sfshaza2
as code owners
September 11, 2026 19:46
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an automatically generated table of contents for blog posts. It adds a new BlogTableOfContents component, registers the TableOfContentsExtension on the server, integrates the component into the blog layout, and adds the corresponding SCSS styles. The review feedback suggests improving type safety in the new component by replacing a direct cast with an is check, and updating the SCSS selectors to ensure the material icon classes are correctly targeted for transition and rotation effects.
- Add BlogTableOfContents, built on jaspr_content's built-in TableOfContentsExtension, showing a collapsible "On this page" nav for posts with at least 2 top-level headings. - Fix scroll-margin-top for heading anchors on www, which was silently a no-op because --site-header-height/--site-subheader-height were never defined for this site.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a table of contents to long-form blog posts, to make navigating them easier.
BlogTableOfContents(packages/site_shared/lib/components/blog/blog_toc.dart), which renders an automatically generated, collapsible "On this page" nav from the post's rendered headings. It's built onjaspr_content's existingTableOfContentsExtensionrather than a custom implementation, so it correctly builds anchor links relative to the current page path. Posts with fewer than 2 top-level headings don't show a TOC.flutter.dev(for example, TOC links, or#some-headingURLs) were landing behind the fixed header instead of scrolling clear of it. The existingscroll-margin-toprule in_content.scssreferenced--site-header-height/--site-subheader-height, which are defined fordocs.flutter.devbut were never defined for this site, silently making the rule a no-op. Defines them, aliased to the existing--ui-header-heightvariable.Fixes #13737
Requested to split from #13870