Here's code for a dynamic JS table of contents


Hi all,

Just sharing what I learned myself recently in case it’s useful - here’s code to put in an HTML block (at the bottom) to add a dynamic TOC based on h2 and h3 subheadings.

I am a JS novice in the scheme of things and enjoyed learning how to do this without jquery (which is only in some themes) to keep it lightweight.

Next up, trying to host a JS file on my server so I don’t have to copy paste… can’t figure out the nginx config!


closed #2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.