Disco TOC for replies

Since Disco TOC is one of the theme components in the default list, I’m assuming this is an appropriate place to make a feature request.

It currently only works for the OP. I’d like to be able to add a TOC to a reply. Why?

When we do a webinar, we’ll announce it to the community with a post. After the webinar, we follow up with a reply in the same topic that contains the link to the recording and answers to all the questions that were asked during the webinar. We do this partly as a way to cover all the questions we couldn’t get to during the live session.

Those followup posts tend to get long and are typically sub-categorized by broad topic - perfect for a TOC (& actually the reason I installed the component).

Previously I’ve manually (and painfully) created a static TOC at the top of the reply post, but of course, once you’ve scrolled past it to the content, it’s no longer useful. Having the Disco TOC float alongside the content would be wonderful!

4 Likes

Interesting use case! I’ve done this in the past before too. Not sure if this will work in your case, but what we ended up doing is editing the first post to add the notes at the bottom, then replying to let everyone know about the edit. That way everything is neatly organized in the first post for posterity.

2 Likes

Perhaps its my long-ago days as a journalist, but I tend to be leery of editing history…

2 Likes

Yes, I totally get that. :slight_smile: But it can be useful for the long term, and Discourse provides the edit history for those who want full transparency. Here’s an example of a topic that we rewrote after a webinar, back when I was working for Namati. We even changed the language to be past tense, so a summary of the webinar and no longer an announcement. And removed all the logistical details on how to join and so on, because no longer relevant.

3 Likes

For anyone who wants to apply DiscoTOC in their replies, I did this part of the work in my own fork!
Now it can apply TOC to any post and it works fine, just like it does on the OP.
It seems that the official team doesn’t think it’s necessary to apply DiscoTOC in the replies, so I won’t open a pull request. But you can use my modified version!

https://github.com/Lhcfl/DiscoTOC-edited

3 Likes

TOC in the replies - yes please!!

2 Likes

A TOC for reply posts is possible - see here for the very out-of-the-box method.

4 Likes

For me as heavy iPad/iPhone user that solution is more like closed-in-box :stuck_out_tongue_winking_eye:

1 Like

hmmm, :thinking: I’m using an iPad Air with Safari iOS 16.6 and it works as expected and the same as Chrome. :woman_shrugging:t2:

1 Like

Lhcfl/DiscoTOC-edited throws the error «Uncaught TypeError: ((intermediate value) || this[e]) is not a function» on inserting a table of contents.
Discourse 3.2.0.beta4-dev.

Oh, I‘ll look into it.


This is an automatic merge error that occurred when I synchronized with the upstream. Now I have fixed it.