Skip to content

fix: remove redundant TOC picker from legacy HTML template.#808

Open
ubay1 wants to merge 6 commits into
nodejs:mainfrom
ubay1:fix/redundant-toc
Open

fix: remove redundant TOC picker from legacy HTML template.#808
ubay1 wants to merge 6 commits into
nodejs:mainfrom
ubay1:fix/redundant-toc

Conversation

@ubay1
Copy link
Copy Markdown

@ubay1 ubay1 commented May 22, 2026

Removed the __TOC_PICKER__ placeholder from the template and its corresponding generation logic in replaceTemplateValues.mjs to avoid rendering a duplicate Table of Contents in the API documentation layout.

Description

This change removes the extra Table of Contents picker rendered in the content header area of the generated API documentation pages.

The sidebar navigation already provides the full documentation index, so rendering another TOC picker in the page header created redundant navigation and unnecessary visual clutter.

This update removes:

  • The __TOC_PICKER__ placeholder from the HTML template
  • The related generation logic in replaceTemplateValues.mjs

Validation

  • Generated API docs locally using doc-kit
  • Verified that the duplicate TOC section no longer appears in the content header
  • Confirmed sidebar navigation and other pickers continue to function normally

Related Issues

Fixes nodejs/node#60667

Check List

  • I have read the [Contributing Guidelines](https://github.com/nodejs/api-docs-tooling/blob/main/CONTRIBUTING.md) and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.Removed the __TOC_PICKER__ placeholder from the template and its corresponding generation logic in replaceTemplateValues.mjs to avoid rendering a duplicate Table of Contents in the API documentation layout.

Removed the `__TOC_PICKER__` placeholder from the template and its corresponding generation logic in `replaceTemplateValues.mjs` to prevent duplicate Table of Contents rendering.
@ubay1 ubay1 requested a review from a team as a code owner May 22, 2026 08:10
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview May 22, 2026 10:44pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 22, 2026

PR Summary

Medium Risk
Adds a new CLI/config-driven redirect script and home-link behavior for the legacy HTML index page, which can change navigation and URL handling. Risk is limited to the legacy-html generator output but could cause unexpected redirects if misconfigured.

Overview
Adds support for redirecting the legacy HTML index.html to a configurable target via new CLI flag --index-redirect-url and corresponding legacy-html.indexRedirectURL configuration.

Updates the legacy HTML template and replaceTemplateValues to inject a redirect script + configurable home link, and conditionally suppress the __TOC_PICKER__ on the index page when a redirect is enabled.

Reviewed by Cursor Bugbot for commit edff75f. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/generators/legacy-html/utils/replaceTemplateValues.mjs
Copy link
Copy Markdown
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This affects every page of an already legacy UI, why?

- Added a new CLI flag: --index-redirect-url.
- Added redirect handling for generated index.html pages.
- Added a smart JavaScript redirect with a meta refresh fallback
- Replaced the hardcoded / header link with a configurable __HOME_LINK__ template value
@ubay1
Copy link
Copy Markdown
Author

ubay1 commented May 22, 2026

This affects every page of an already legacy UI, why?

Sorry, I misunderstood the scope of the issue initially. You're right that the original approach was too broad since it affected all pages in the legacy UI.

I've reworked the implementation so the behavior is now opt-in via a new --index-redirect-url configuration. This allows consumers (like nodejs/node) to redirect only the generated index.html landing page to something like documentation.html without changing the behavior of other legacy pages by default.

Comment thread src/generators/legacy-html/utils/replaceTemplateValues.mjs Outdated
Comment thread src/generators/legacy-html/utils/replaceTemplateValues.mjs Outdated
@ubay1
Copy link
Copy Markdown
Author

ubay1 commented May 22, 2026

Screen Recording 2026-05-23 at 04 04 04

Comment thread src/generators/legacy-html/utils/replaceTemplateValues.mjs Outdated
Comment thread src/utils/configuration/index.mjs Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0206b3b. Configure here.

Comment thread src/generators/legacy-html/utils/replaceTemplateValues.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render "About this documentation" as the landing page for the documentation section

2 participants