How to add a table of contents tutorial

In the How to add a table of contents tutorial it says:

Edit default.hbs

Open default.hbs in a code editor. In this file, add the Tocbot script and styles.

It would be a good idea at this point to tell readers HOW to edit default.hbs.

I haven’t a clue, searching the site hasn’t helped me find anything.

You’re following this tutorial, right? I think that page’s headers aren’t as clear as they could be, but the next several subsections after ‘edit default.hbs’ tell you specifically what code to put where. :slight_smile:

As an aside, if it were me, I wouldn’t edit default.hbs, because I only want a ToC on my posts and pages. In that case, you’d edit post.hbs (and also page.hbs, if you have a separate one). No sense in loading the extra javascript on the index pages where it won’t actually get used.

Thanks. Yes that makes it a lot clearer.

I want the TOC on just one page. Putting one on every post would be crazy. It looks as if it would be easier to handcraft it on an HTML card and maybe store it as a snippet in case I ever need to do one again.

That’s an option. If you thought you’d want it somewhat frequently, a custom post type might be the way to go. :)

For one page, handcrafted is the way to go, I think.

Thank you for the feedback on the tutorial. I’ll update it and try to make it clearer!

1 Like