Skip to content

Render FAQ answers as collapsibles - #275

Merged
thilak009 merged 1 commit into
mainfrom
feat/collapsible-faqs
Oct 15, 2026
Merged

thilak009 merged 1 commit into
mainfrom
feat/collapsible-faqs

Conversation

@thilak009

Copy link
Copy Markdown
Contributor

Summary

FAQ sections on 229 pages (1,397 questions) now render each question as a collapsible, so long FAQs no longer stretch the page. The markdown is unchanged: questions stay as ### headings under ## FAQ.

  • src/plugins/rehype-faq-details.ts: a rehype plugin that, at build time, wraps each ### question and its answer in <details class="faq-item">, keeping the <h3> inside <summary>. Turned on for docs and src/pages.
  • src/clientModules/faq-anchor.ts: when a link or the table of contents points at a question, that question opens.
  • src/css/custom.css: replaces the default Docusaurus alert-box look with a plain list of questions, with dividers and an arrow. The # link inside a question is hidden, because a click there opens or closes the answer instead of following the link.
  • CLAUDE.md: notes that FAQ collapsibles are generated, so nobody writes <details> by hand.

SEO

  • Answers are still in the static HTML. Docusaurus Details renders with lazy={false}.
  • The FAQPage JSON-LD is byte-identical to a build of main on all 229 pages, so faq-schema.ts is unchanged.

Known limitation

Browser find (Ctrl+F) doesn't search inside closed answers. We've accepted this.

Test plan

  • npm run check passes
  • FAQPage JSON-LD diffed against a build of main: no differences
  • Opening /api/authentication/#what-happens-when-i-revoke-a-key opens only that question
  • Styling checked by hand in the browser

🤖 Generated with Claude Code

Long FAQ sections made pages hard to scan. A rehype plugin now wraps each
### question under ## FAQ in a <details> at build time, so the markdown
stays as plain headings. The <h3> stays inside <summary>, which keeps
heading anchors, the TOC and faq-schema.ts working; FAQPage JSON-LD is
byte-identical to main on all 229 pages. A client module opens a question
when a link or the TOC targets it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thilak009
thilak009 merged commit 8f25b2b into main Oct 15, 2026
5 checks passed
@thilak009
thilak009 deleted the feat/collapsible-faqs branch October 15, 2026 09:42
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.

1 participant