We’re trying to set up a topic as a sort of FAQ/forum usage guide, and in doing so we’d like to have a number of longer posts, each with a number of headings, and compile a table of contents in the first post of the topic so users can easily jump around.
This is proving deceptively difficult to make work as intended and digging around Meta isn’t really helping, unfortunately. We’re aware of the plugin-thingy (auto-ToC or whatever it’s called), but we just want this for one singular topic and so don’t really want to deal with that.
We’ve tried using the link icons next to an auto-generated markdown header via the # symbols, but that isn’t working - we’re not sure if this is just because of the colors we’re using for the headers, or something else entirely, but in any case this works for some but not all of our headers.
Trying to use HTML tags with manual ids for our headers had no success either - this just wasn’t jumping to the links at all. We saw somewhere on Meta that the id information was being stripped out by Discourse and stopped pursing this approach.
We then saw a clever idea using empty links placed right above our headers that you could just jump to, and although this at first seemed to work after we get a few posts down it also stops jumping to the correct place in the linked post.
Does anybody know why headers seem to be so broken, and how we can make them work across multiple posts within a single topic? I’m classifying this as a bug, because the behavior seems incredibly undesirable, but I’d be okay jumping through some hoops on our end to get this working if anybody knows how.
For anchors to work across longer topics you would need to use the full post address with the header appended to compensate for the target post not being loaded on the screen.
If the anchor was <a name="anchor"></a> in the OP of this topic, using this link would work even in post eg 456
We tend to use try.discourse.org for these, but it may be more effort than it’s worth in this case?
The only thing that looks different than the ones I use is the double hyphen, but that seems a long shot. Perhaps it’s the amount of header links? I’m not sure.
They work for me the first time, and on a page refresh, but don’t when I use the navigation timeline to return to the OP.
I have ‘go back’ links in my similar posts with the full post address of the OP/TOC headers in, which would perform a page refresh. Would that work for you?
However, nobody navigates like that normally, so I definitely think this is a pretty clear-cut bug and ideally should be patched when the team has time to get around to it
Actually we’ll probably just only link to the top-level posts, and add in the specific section anchors when it’s been fixed
Seems better than a broken feature for our users
Is there any way to save this post on Try from getting wiped so somebody who knows more about Discouse than I do can poke around to figure out why this is happening?
You could open those posts up in edit mode or grab the raw version and copy them over to a topic on your site as a more permanent example to link to (or to save them and recreate them on try again at a later point).