How do I make a sticky table of content sin the sidebar?

  • Unknown's avatar

    I was going through the theme documentation and I found this cool sticky table of contents in the sidebar on wordpress.org documentation site. I tried to replicate it by adding the default table of contents block to the sidebar but it doesn’t work as the block doesn’t detect any headings from the post content. i was wondering if anyone knows if there is a way to replicate this?

    The blog I need help with is: (visible only to logged in users)

  • Hi @sriharshakoduru,

    For this setup, you can try to add the Table of Contents block inside the page or post content itself. From there, you can place it inside a Group block and set that Group to a sticky position so it behaves like a sidebar while still detecting your headings. You can check more on the TOC block here: https://wordpress.com/support/wordpress-editor/blocks/table-of-contents-block/

    If that setup doesn’t meet your needs, a third-party Table of Contents plugin would be another option.

Log in or create an account to reply