So, I'm writing a forum user guide with an index. I have the topics all as heading 3 so I can link to it from the index. But I would like to be able to jump back to the index instead of having to scroll back up. Is there a way to do this?
My first thought would be that you could create a BBCode tag that inserted either an anchor element or a span element with an ID (that was passed as either an option on the BBCode or as the content of the BBCode). Then a normal fragment link (ie blahblah#my_id_fragment) should jump to that element from a normal hyperlink. Pop your new tag by your menu and it might do the job.
Yes, but I have several topics with #3 headings per post and I would like a link back positioned after each heading and as a small icon, like so e.g. where the tooltip in my User Guide would say: jump back to the index:
But I don't think that's possible. So I probably will do it with a simple internal link.
I asked ChatGPT and it gave me several options, none of which worked because the XenForo editor is limited. Obviously. So in the end it found me a little icon for an internal link. Because it's small it doesn't look too bad above an entry, but it's still not very pretty:
ChatGPT suggested I put every topic in its own post. That way I don't need the #3 Headings, can simply link internally and I'll be able to put a little icon right where I want it. It's probably the best advice it gave me. The downside is that some entries are pretty short. Still, I'm considering that now.
If you want content on the same line as the header (ie the line with the <h4>title</h4> tags) you will need to style those as being inline.
Given you probably don't want to do that to all your headings I'd still consider wrapping them with a custom BBCode. So say you create a BBCode tag called menulink that takes an option which could be a URL+fragment (and do consider at least a regular expression to prevent abuse of this user submitted field) you could markup your section headers something like: [menulink="/foo/bar"][HEADING=3]section header A[/HEADING][/menulink] . If the BBCode HTML replacement were something like: <div class="menulink">{text} <a href="/threads/{option}">^^^</a></div> and you additionally styled the "menulink" in your extra.css template with something like: div.menulink>h4.bbHeading { display: inline; } I'd have thought that would get you what you're after.
Obviously (I hope) you'd need to decide quite what your link is going to point to and how much of that link you accept from the BBCode and how much you hardcode in. Remember you want to avoid anyone abusing this BBCode tag so a combination of a bit of hard coding and a regular expression to ensure whatever entered is just a fragment link to another post (ie the one with your menu in) would be in order.
I might also still be tempted to consider using a BBCode tag to "mark up" the menu, something like [menu=main] ... [/menu] which dumped in an HTML anchor and then maybe each menulink (or whatever you call it) tag can just be a fragment to the name of that menu, ie [menulink=main] header [/menulink] which might be neater. Anyhow I'd be doing something along these lines I think to create what you're after.