3 ms·
Build a Modern Table of Contents in Gatsby Without DOM Fetching or Extra Plugins
- javatuts 2y agoOur approach will leverage Gatsby’s powerful GraphQL data layer to fetch headings from markdown or MDX files at build time. We will then use this data to generate the TOC without the need to parse the DOM dynamically. The end result is a static, SEO-friendly TOC that can be styled and customized to match your site’s design.