# DiscoTOC - automatic table of contents

**URL:** https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143
**Category:** Theme component
**Tags:** official, disco-toc
**Created:** [March 9, 2019, 5:36am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143 "2019-03-09T05:36:22Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Kai\_Kretschmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kai_kretschmann/32/235943_2.png) [@Kai\_Kretschmann](https://meta.discourse.org/u/Kai_Kretschmann)
#### Post date: [October 12, 2021, 6:50am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/288 "2021-10-12T06:50:15Z")

</div>

I wonder if the ToC does work on those ToS, FAQ, Privacy pages which run from the Discourse links like /tos and /privacy?  
For me I don’t see the ToC there, but on the page in the matching category with the same content it is shown again.

---

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [November 9, 2021, 12:49am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/289 "2021-11-09T00:49:22Z")

</div>

This component is wonderful! But is there any way to batch-add a ToC to many topics at once? I have 130 topics that I’d like to use this with…

Also, I wonder if it could pick up numbered and perhaps even bulleted text? Perhaps not… they’d often have a lot of text next to them, cluttering the ToC.

---

<div class="post-metadata">

### Author: ![useful\_dragon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/useful_dragon/32/238422_2.png) [@useful\_dragon](https://meta.discourse.org/u/useful_dragon)
#### Post date: [November 9, 2021, 1:17am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/291 "2021-11-09T01:17:05Z")

</div>

Brilliant. Thanks for sharing! 👍👏

---

<div class="post-metadata">

### Author: ![zavorio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zavorio/32/225332_2.png) [@zavorio](https://meta.discourse.org/u/zavorio)
#### Post date: [November 18, 2021, 8:54pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/292 "2021-11-18T20:54:14Z")

</div>

> [@Johani](#):
>
> ### How do I create a toc?
> 
> 1. Write a topic with syntactically correct headings
> 2. Click the toc button in the gear menu (only shows up when creating a regular topic - replies and PMs are ignored
> 3. Profit.

@Johani Just installed this, works perfectly and it is super useful. And thanks for not letting this meme die, lol.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [January 2, 2022, 11:47pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/295 "2022-01-02T23:47:44Z")

</div>

> [@neo](#):
>
> after install this component it looks something wrong, could you tell me how to fix this problem?

I’ve got this problem too, but it only occurs on some posts. It doesn’t seem to be a conflict with other TCs or plugins, and I can’t see anything when inspecting it via the browser that would explain it:

> ![image](https://global.discourse-cdn.com/meta/original/3X/2/5/258cbfb5d2d20581b17742ea067674e7a3e16d49.png)

---

<div class="post-metadata">

### Author: ![nobodyfrm](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nobodyfrm](https://meta.discourse.org/u/nobodyfrm)
#### Post date: [January 3, 2022, 7:52pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/296 "2022-01-03T19:52:09Z")

</div>

Is it possible to not only have the headings from the first but all posts in the toc since we are looking to implement this plugin for story threads where each chapter is posted separately alongside with comments of other users

---

<div class="post-metadata">

### Author: ![Dugen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dugen/32/198936_2.png) [@Dugen](https://meta.discourse.org/u/Dugen)
#### Post date: [January 3, 2022, 11:26pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/297 "2022-01-03T23:26:54Z")

</div>

Has anyone else noticed that the posts with the TOC are scrolled down slightly when the page loads?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 4, 2022, 3:46am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/298 "2022-01-04T03:46:05Z")

</div>

I’ve noticed this. Always thought it was me touching my (sensitive) scroll wheel.

---

<div class="post-metadata">

### Author: ![Dugen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dugen/32/198936_2.png) [@Dugen](https://meta.discourse.org/u/Dugen)
#### Post date: [January 4, 2022, 6:20pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/299 "2022-01-04T18:20:35Z")

</div>

Not that you would know, but do you think that would be a css issue or a scripting issue? I forked the repo and have been trying to find the cause, I find it very annoying.

---

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [January 5, 2022, 9:47am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/300 "2022-01-05T09:47:40Z")

</div>

In your image did you also have more than one anchor on the right side like in this image?

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/b/abf1a445c13ada2386db01e26adc84b676523156.jpeg)

I notice that this issue appears for me when more than one anchor is present, and I’m wondering if the extra anchors are pushing the rest of the post slightly more to the left, or at least making toc wider than it’s supposed to be, which forces the sticky avatar to pop above, and then consequently overlap when you scroll down.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [January 5, 2022, 12:56pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/301 "2022-01-05T12:56:31Z")

</div>

Yes, but it seems to disappear when I reload the page (most of the time). So it is a little hard to reproduce reliably.

---

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [January 5, 2022, 12:59pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/302 "2022-01-05T12:59:26Z")

</div>

I’m seeing the same behaviour. Maybe this is only an issue for the person authoring/editing the post?

---

<div class="post-metadata">

### Author: ![craigconstantine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/craigconstantine/32/511195_2.png) [@craigconstantine](https://meta.discourse.org/u/craigconstantine)
#### Post date: [January 5, 2022, 1:02pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/303 "2022-01-05T13:02:22Z")

</div>

> [@nathank](#):
>
> Yes, but it seems to disappear when I reload the page (most of the time). So it is a little hard to reproduce reliably.

I believe you can repro if you edit the post, save… and you’ll have the double double anchor issue . . .

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [January 5, 2022, 1:05pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/304 "2022-01-05T13:05:02Z")

</div>

I also get the malalignment on an unedited topic, but without the anchor problem:

> ![image](https://global.discourse-cdn.com/meta/original/3X/2/3/2350efe489e07fd1ddef56fc999a9517207c4518.png)

---

<div class="post-metadata">

### Author: ![kiwikid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kiwikid/32/129688_2.png) [@kiwikid](https://meta.discourse.org/u/kiwikid)
#### Post date: [January 17, 2022, 8:43am UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/305 "2022-01-17T08:43:23Z")

</div>

Thanks for creating this wonderful plugin!

I’m getting a server 500 error on trying to update DiscoTOC.

Have just updated discourse, and going through any themes, etc that are flagged as having updates. This list includes DiscoTOC.

I tried a manual update via he UI, but it fails with a server error 500. So enabled “auto-update” and restarted the machine. Discourse fails to start. Then tried rebuilding the container → discourse doesn’t build/won’t start.

Starting the container manually and deleting DiscoTOC via the UI gets everything working again… but now we have no DiscoTOC (☹ )

I have also tried downloading as a zip file from github and got the same issue.

I don’t see anything obvious in the logs that I’ve looked at.

Any suggestions for what to try?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [January 17, 2022, 6:08pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/306 "2022-01-17T18:08:06Z")

</div>

Hi Julian,

Sorry you’re having trouble. I just updated my self-hosted site to see if I can replicate your problem and am able to update without any issues, so perhaps a recent refactor to discotoc @pmusaraj has been working on is conflicting with one of your other plugins or theme components?

Can you try to test some more by reinstalling DiscoTOC, and then looking at the page with the javascript cosole open? If you see any errors there, please let us know here. Also can you check your /logs for any errors that correspond to the times when you are getting the 500 error?  
Cheers,

Tobias

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [January 17, 2022, 9:38pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/307 "2022-01-17T21:38:32Z")

</div>

Can you install any theme components @kiwikid? The error you’re seeing likely has little to do with DiscoTOC, it sounds to me like your instance can’t install components at all. (Also, I just removed and reinstalled DiscoTOC on a test instance, and it worked just fine.)

For the record, I am going to merge a PR that changes a lot of the internals of the component in the next few hours/days.

> <https://github.com/discourse/DiscoTOC/pull/19>
>
> \- Uses \`topic-navigation\` and \`after-topic-progress\` outlets for better placemen…t of TOC and more stability
> - expanded/collapsed state of component relies on core's full vs minimized timeline placement, so it should be more stable
> \- Moves JS code into separate files
> \- Simplifies/centralizes SCSS (and avoids
> \- Removes all usage of jQuery

---

<div class="post-metadata">

### Author: ![kiwikid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kiwikid/32/129688_2.png) [@kiwikid](https://meta.discourse.org/u/kiwikid)
#### Post date: [January 17, 2022, 11:03pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/308 "2022-01-17T23:03:10Z")

</div>

Thanks for the quick response @pmusaraj. Before posting I successfully added a couple of themes. Just added [Topic Stopwatch](https://meta.discourse.org/t/topic-stopwatch/83939) in case something is broken/different re theme components. That installed cleanly with no issues. Also added the Kanban addon that was in the automatic “popular” list with no issues.

I also tried installing the DiscoTOC refactor branch last night and had the same issue.

I Used `https://github.com/discourse/DiscoTOC` as the URL and manually set the branch name from master → main.

All it gives me is a server error 500 ☹

Trying the two year old branch `marks-testing` installs fine (!)

Dashboard shows Discourse version is 2.8.0.beta11 (cbf99f48d8).

Plugins installed and active: discourse-chat-integration, discourse-voting, discourse-formatting-toolbar, discourse-graphviz, discourse-hot-topics, discourse-math, discourse-solved, discourse-user-notes, discourse-whos-online, docker-manager. Also styleguide plugin is installed but not active.

Let me know if there’s any other info I can collect to help debug this!

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [January 17, 2022, 11:12pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/309 "2022-01-17T23:12:37Z")

</div>

> [@kiwikid](#):
>
> All it gives me is a server error 500 ☹

Anything in /logs? These 500s should have more details in logs.

---

<div class="post-metadata">

### Author: ![thaidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thaidb/32/68488_2.png) [@thaidb](https://meta.discourse.org/u/thaidb)
#### Post date: [January 18, 2022, 9:15pm UTC](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/310 "2022-01-18T21:15:43Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/3X/e/1/e1babe50f03630e3a25bf250708c6f80d86d4b42.png)  
Hello Joe,  
I wonder why table of content not Full right display!  
What did i do wrong? So, can you fix for me? Thank you!

[Previous page](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143.md?page=1)

[Next page](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143.md?page=3)
