In a Support topic titled “HTML Anchors? (not Discourse bookmarks)”, RobMeade asked if HTML anchors (e.g., <a id="bookmark"></a>) could be used to deep-link to specific points within a long post — similar to how reply numbers work. He found that adding #bookmark to the URL didn’t scroll to the target. SidV suggested checking the forum’s /guidelines page for working examples, which RobMeade tried — but noted the anchors only worked when clicked from within the page, not when pasted into a new tab. fefrei clarified that Discourse supports deep-linking to headings with IDs starting with heading--, per this meta topic. RobMeade asked if headings were mandatory — he wanted to link to images without adding visible headings. fefrei confirmed <a> tags alone don’t work. Ultimately, RobMeade solved it by inserting empty heading tags (e.g., <h2></h2>) — which create minimal extra spacing but enable working anchors. He thanked the community and marked the issue resolved.
I tried to use HTML to pop some bookmarks into a post today, so that from another link you could get to a specific point in a lengthy post.
I couldn’t seem to get it to work, is this something which isn’t currently supported?
I added this within the post;
<a id="bookmark"></a>
..and then, on the end of the URL in the browser, added;
#bookmark
I hit enter, but nothing changed, e.g. I wasn’t scrolled down to the bookmark automatically. What I am trying to incorporate is the same functionality I suppose as you already use for the replies to a topic (the reply numbers etc), but this would be for say a wiki post which doesn’t have replies, it’s just quite long.
Thanks for this, is the use of headings mandatory? In my specific case the lengthy page has a number of images on it which I wanted to direct people to specifically, without having to add a heading above each one etc.
I will go and test, but anything further would be appreciated.
Thanks for the info, and yeah, I can’t either… hmm… will have to think on this one as having the text isn’t really what I wanted to do.
Update
/facepalm moment two…
Ok, so I just added an empty heading tag and of course it works perfectly… it does render a little extra “space” where the heading tag would be, but nothing that’s really a problem.