Table of Contents- Remove From a Specific Page

Hello, I recently created a table of contents using the official ghost blog tutorial as seen here:

I am wondering if there is an easy way to make it so the table of contents won’t display on a certain page. I was thinking of using code injection on the pages i didn’t want it to display and have it so the table of contents won’t display if a specific tag is used, but I wasn’t sure how to go about doing this.

Any help would be great, and if there is an easier way to go about this I am all ears, thank you!

You are right-- you could inject some bit of JavaScript on pages you want to hide it. From what you linked to, it appears the class name to hide would be gh-toc.

Regarding using a tag to hide it: You could review the source code of a page to see how tags are presented on a post.

Then you could add JavaScript directly to a template that parses out the page to check tags to decide when to hide the “div” tag or not.

Sorry, I don’t have specific code for you because I’m not great with Ghost frontend updates, but I’m affirming that what you want to do is possible and shouldn’t be too hard for someone familiar with Ghost theming and JavaScript.