DiscoTOC - automatic table of contents

Is there a way to move the TOC to the left side of the post, rather than the default right side?

1 Like

I’ve also been trying to figure this out. It’s nice to be distinctive, but table of contents are almost always on the left side of sites, which makes sense given that we read left to right. Is there a way to do this?

1 Like

How can we keep the table of contents on the left and keep the standard discord scrollbar on the right? I have some difficulty getting to the bottom of a post since the scrollbar has changed.

Here is an example:

2 Likes

Hello AntiMetaman,

You can change the direction with css. Add something like this to desktop css section. It should show the DiscoTOC on the left side.

.d-toc-post .d-toc-article{
    flex-flow: row-reverse;
}
3 Likes

I don’t know how this component is implemented or much about the frontend structure of Discourse, so I can only throw in a guess.

Couldn’t the progress bar only be shown a) if more than 1 post in the topic and b) adjust its start to be from the 2nd post (instead of 3rd), but also c) add some comfortable bottom/top margin to one of the two elements to make sure the other remains distant enough (eg 1vh) as to not make it strange looking?

In other words, instead of using the whole 2nd post as a gap, use CSS to allow some room between them (iff there’s more than 1 post).

Again, this might not make any sense at all as I don’t know much about the way this is working atm.

3 Likes

I am wondering how the TOC plugin is intended to function as I am finding its behaviour sort of odd. I have attached an animated gif below showing my observed behaviour. Is this intentional?

My personal thought/preference is that the TOC is just fully expanded from the start.

Thanks in advance!

1 Like

I am bumping this in hopes that someone will comment on the above functionality.

Is this functionality as intended? Am I doing something wrong? Is there a possibility to get the option to set the TOC to be fully expanded and static?

Thanks in advance!

1 Like

Is there a plan, that the TOC is also visible for published pages? Page publishing was a feature introduced in discourse 2.5? This would be a huge benefit of this theme component!

6 Likes

I checked it with non-Latin symbols like Cyrillic and it’s not working. When I copy the url of the subheader and try to follow the link - the TOC is not working (the page opens, but doesn’t move to the subheader). How can it be solved?

1 Like

Another question. I added extra div to the post. Now it looks like this:

<div data-theme-toc="true"> </div>
<div data-theme-profile="manual">
## Chapter 1
## Chapter 2
</div>

But the TOC is not visible in this case. How can it be fixed?

1 Like

Hi, I noticed an odd interaction with DiscoTOC and Slack integration. Basically the header links don’t properly post.

See details here

2 Likes

That is because the heading links do not include the path to the topic. For example <a name="overview" href="#overview">. The Chat Integration plugin is attempting to convert relative links into absolute links by prepending the forum’s root URL to any links in the post, but that is not going to work for the header links because the path to the topic is missing.

A possible solution would be for us to add the path to the topic to the TOC href element. For example, instead of setting <a name="overview" href="#overview">, the href element would be set to something like /t/your-topic-slug/1234#overview".

2 Likes

Hello,

How I can add into all my existing post the toc ?
I don’t want add this manually :slight_smile:
Perhaps with rake post ?

regards

Ludo

1 Like

Is there any way to make the entire TOC show up at once instead of dynamically hiding most of it? A full post outline can be useful for finding a section without knowing and clicking through its ancestry, or so you can just read all the section names as a way to skim a post.

2 Likes

Hi there! We recently installed DiscoTOC for our forums and were wondering if it’s possible to get the component to read alt text in images? We’ve used images for some patch note headers…

like so:
Performance and Stability

And unfortunately the TOC system doesn’t seem to be able to parse an image as a header, creating a blank entry on the list and creating a link that takes you to a blank page. Is there any workaround for this beyond “don’t use images”? Thank you! Love the system otherwise.

1 Like

My guess is that the solution is to not use images as headings, but possibly there will be a way to get it to work by adding some code to your site that hooks into the DiscoTOC code. Whether or not it’s worth looking into that will depend on how important it is for you to use images in the post’s headings.

3 Likes

We’ve been using images as headers in our patch notes consistently for quite some time now, and it’s a part of our branding and presentation; not just on the forums, but on Steam and such as well. We would like to have the ability to continue using images as headers while using DiscoTOC in order to remain consistent.

DiscoTOC has been great for other things such as for an AMA recap, a megapost about our dedicated server launcher app, new player guides, etc. We like the system a lot, but would love for a little extra functionality for the way we present patch notes.

1 Like

I would second this feature request. I can see that this might result in long TOCs, but at least one could add an “expand all” button or Link?

1 Like

The heading anchor functionality on this component slightly conflicts with the Automatic header links functionality added in 2.7.0beta6, since headings get two icons on hover, one from Discourse and one from DiscoTOC. Is there a way round this?

1 Like

Hello,

You can hide the Automatic header links anchor with

.anchor {
  display: none;
}