Alternative post ID

Discussion in 'Comments and Suggestions' started by EStjarn, Aug 20, 2013.

  1. EStjarn

    EStjarn Senior Member


    I am involved in preparing the text and format of several posts that will constitue an index thread, using BBCode. For reasons of editing, this work is partly done outside the forum. Some of the posts are supposed to link to some of the others.

    Providing the thread ID is known and the post order within the thread is also known, is it possible to create those links in advance, that is, without knowing what post IDs the relevant posts will come to have? Or is it necessary to first create the posts and then add the links?

    (I was thinking that perhaps there existed some alternative format for linking to a post, for example, one that used the thread ID + the post's number within the thread, say "#89" for post 89.)
    Last edited: Aug 20, 2013
  2. jann

    jann co-mod'

    English - USA
    No, not with BB code.

    Your BB code options are [threadid] or [postid]. The former creates a direct link to t=xxxx, while the second creates a direct link to t=xxxx&p=yyyy. There is no way to link to a certain thread and then subsequently scroll to a given post using BB code without knowing the postid number and using the [postid] tag. In other words, there is no way to use BB code to append instructions onto the [threadid] tag that will cause the page to scroll to the 3rd (4th, 7th, etc.) post.

    However... HTML offers this possibility.

    1. Use the tag and append #4 to the end of"]this link to that scrolls to post #4 in the C&S sticky. You'll notice that the top of the post tends to scroll off the page a bit. Really, you're just taking advantage of the fact that post #zzz automatically gets hash zzz in the HTML version of the page. Caveat: I haven't tested, so I'm not sure what happens for people who have specified reverse order "linear - newest first" in their thread display options.

    2. Use the [id] tag to create custom hashes within posts. Then create links that scroll to those hash locations using method 1, but replace #4 with #abc where "abc" is whatever text you chose for your custom hash. I think (?) you're limited to six alphanumeric characters without spaces. Don't assign the same [id] more than once in a given thread.

    We have used the [id] tag in the sticky of the French-English Vocabulary forum. For example, creates this link that scrolls to the paragraph entitled "Thread titles". That's because we tagged the words "Thread titles" with hash #e, like this: [id=e]Thread titles[/id]. You'll notice that if you hover your mouse over the orange paragraph titles in that sticky post, most of them get a little alternate text message box that pops up showing you the hash identifier.

    Hope it helps...
  3. CapnPrep Senior Member

    Good to know! The problem with the post numbers is that they are not stable. If a message gets deleted from the middle of a discussion for whatever reason, all the following numbers change. Would it by any chance be possible to make it so that deleted messages still occupied a place in the sequence? So that when people write things like "As so-and-so said in #63 above", we can be sure that the #63 they are referring to is still the current #63?
  4. EStjarn

    EStjarn Senior Member

    Thank you, jann! That should do the trick. :)
  5. jann

    jann co-mod'

    English - USA
    It is quite troublesome, isn't it? I notice it most when we end up merging old threads on the same topic, which can have the effect of "inserting" posts early in the discussion, thus increasing the post numbers of all later messages. I'm afraid that allowing deleted posts to retain their numbering wouldn't help in merge situations.

    As I recall, EStjarn is working on a reference threads project for EO. If links to post numbers will be in stable (non-discussion, hence reference or index) threads that contain lists assembled as part of this project, then the non-stability of post numbers shouldn't be too much of an issue.

    That said, I, too, would advise against using #2 to link to post #2. It's better to have a link that is specific (which is to say breakable, traceable, and fixable). With #postnumber hash links, you risk losing knowlege of where they are supposed to lead. As a moderator, I've done a lot of work on stickies over the years. Generally we build the draft and leave place holders for links until threadids and postids are finalized. I realize, however, that this is only practical if you have editing ability.
  6. EStjarn

    EStjarn Senior Member

    Hello again,

    I liked the above idea particularly and have assigned [id] tags to relevant posts. But I've stumbled on another related problem.

    Say I'm posting in thread #123456, and I want to link from post #23 to post #89. I create an [id] tag in post #89 - for example, [id=oth]Other Symbols[/id] - and a hyperlink in post #23 whose URL would look something like this (save the hyphen in the "http"):


    I can attest to that the method works. But it does so - in this case - only as long as the "Number of posts to show per page" setting is set to 20 per page. If I change the number to 50, the link stops working due to the fact that the URL includes the page number. For the link to work, the URL page reference would have to be changed to "page=2".

    Is there a workaround for this?
  7. Peterdg

    Peterdg Senior Member

    Dutch - Belgium
    This is normal, I think, as the reference is an HTML reference, meaning for HTML to find the tag, the tag must be on the page that HTML gets presented.

    As a possible work around, it may be an option to force the number of pages displayed in the link. I suspect that BB allows that (I suspect this by analogy: BB also allows to change the interface language by putting a special string in the link so I suspect that it may also allow to force the number of pages displayed).

    Someone who knows BB well may be able to be of more assistance.
  8. jann

    jann co-mod'

    English - USA
    Yes, this is normal behavior: you must be displaying the correct page to be able to scroll to the hash id.

    It's true that it's possible to specify a display language in the URL, but unfortunately, I don't know of a way to override an individual member's personal settings for posts displayed per thread (which can be set to "forum default," 20, 50, or 100).

    If you append &page=n to a thread URL when the member's personal settings will result in the thread being displayed on <n pages, then the final page of the thread as per the member's settings is the one that will load. For example, if the thread is 143 posts long and the member views 50 posts per page, the member will have a three-page thread... so &page=6 wil just display page 3.

    Whether or not you can make use of this fact depends on where the post is and how many posts there are in the thread.

    For example, post #86 would be on page 1 for someone who sees 100 posts per page, on page 2 for someone who views 50 posts per page, and on page 5 for someone who views 20 posts per page. As long as there are fewer than 100 posts, you can therefore safely append &page=5 to the threadID and everyone will end up on a page that includes this post.
  9. EStjarn

    EStjarn Senior Member

    Considering the linking between posts that I would like to be able to do, from your answers I get the impression I can't work around this one; it seems the posts will have to be created first. However, I may want to link to sections within posts, which I now know how to do.

    Thank you both for sharing your experience and ideas. :)
    Last edited: Aug 24, 2013

Share This Page