Using Section Headings to create a Table of Contents

3 コメント

  • Ifra Saqlain
    Community Moderator

    Hi Katherine,

    You can go through this article. You just need to do copy-paste.

    Copy script code and paste at your script.js file.

    Copy toc div code and paste at your article_page.hbs file.

    Follow these Steps

    Step 1: Search for {{article.body}} on article_page.hbs.

    Step 2: Add this code <div id="toc"></div> above article-body as in the posted artiocle.

    Step 3: Copy all given script code and paste at your script file at the bottom.

    Step 4: Save and publish.

    Step 5: Now go to your article template on preview mode and check, if your article have headings then TOC would be shown.

    It's very simple to add. You should try this and if any issue let me know.



  • Katherine Breen

    Thank you so much for the quick response. I added the code to the Article page and the script.js file but nothing happened. I'm not sure what I am doing wrong.

  • Ifra Saqlain
    Community Moderator

    Okay, import new/fresh Copenhagen theme in your Help Centre and then add this code in that. After adding, open that article which have headings, because if your article haven't any heading- TOC won't show/nothing will happen.

    Also share your public URL of your Help Centre here. May be something is in your code because I tried this and all working fine.




Powered by Zendesk