Missing anchor links in certain TOC topics?

I seem to be missing the anchor links next to the headings, which allowed me to link to a specific section directly, for instance in this topic, like described in the start post:

Is this me or did this functionality disappear?

2 Likes

They should be there? I’m currently on my phone, but I grabbed this one by long-pressing on the gap to the side of the heading:

https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143#how-does-it-work-3

2 Likes

Yes, that topic has those anchor links, but that’s a topic that does not have the DiscoTOC.

But this topic has a TOC and does not have anchors: Beginner's guide to using Discourse Themes and this one does not have anchors either DiscourseConnect - Official Single-Sign-On for Discourse (sso)

EDIT Hmm…this topic does have anchors: Discourse API Documentation

3 Likes

Ah, I can explain. The topic you linked has html headings (<h3>, <h4> and so on) and initially the TOC component had its own logic for adding heading anchors. However, since then, core added automatic anchors and recently I removed the custom anchor login in the theme component. However, core’s anchor feature only works for Markdown headings (using ###).

So that’s the OP here has anchors, but the linked guide doesn’t.

We probably should update that guide to use Markdown instead of HTML @JammyDodger.

5 Likes

Ah! That explains things perfectly, thanks Penar!!

4 Likes

I was clearly not paying enough attention yesterday. :slight_smile: I have now swopped in Markdown headers for the two example topics. :+1:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.