1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Digital Point [thread] & [post] BBCode

Discussion in 'Add-on Releases [Archive]' started by digitalpoint, Oct 24, 2011.

Thread Status:
Not open for further replies.
  1. digitalpoint

    digitalpoint Well-Known Member

    About
    This adds two BBCodes... [thread=xxxx] and [post=xxxx]. It allows you to link to a specific thread/post and the link will change if the URL structure ever changes.

    Installation
    • Put the contents of the library directory into your XenForo library directory.
    • Install the addon-dpThreadPostBbCode.xml file in your Admin Control Panel -> Install Add-on option.
    Usage
    It's pretty simple, [thread=1234]A thread[/thread] will create a link to thread ID 1234 with the anchor text "A thread".
     

    Attached Files:

  2. Digital Doctor

    Digital Doctor Well-Known Member

    So simple, so useful. Great job !

    Would it be possible to have a pretty icon in front of the Anchor Text ?

    digitalpoint.thread.post.link.with.icon.jpg
    Maybe the link icon could be selectable by the end user ?
     
  3. Digital Doctor

    Digital Doctor Well-Known Member

    Is the main "purpose" of this to avoid broken links if the URL structure changes ? or easy to generate links to important threads ? or both ? or 30 / 70 % ? :)
    Is the admin whom would use this going to keep a list of the thread URL numbers in a text file or something for easy reference ?
    ie. How would I know the xenporta thread's number ?
     
  4. digitalpoint

    digitalpoint Well-Known Member

    Probably wouldn't be too hard... just add a special class to the link, and then if someone wanted to apply the leading image (or anything else really), they could do it with CSS.

    You can find the thread ID by looking at the normal URL... like this one is 22076... the post ID you can see in the hash portion of the URL when you click on a post's URL.
     
  5. Digital Doctor

    Digital Doctor Well-Known Member

    Yea. I know HOW to get the number. But I am trying to think where I would store the numbers so I can find them when I need them.

    Is the purpose mostly for future proofing links ?
     
  6. James

    James Well-Known Member

    Are you referring to when he said it'll work even if the URL structure is changed? You don't need to store a lookup of IDs, you just use XenForo's link builder with the BB Code ID.
     
  7. digitalpoint

    digitalpoint Well-Known Member

    That's part of it... the other part is I have thousands of posts in my existing forum that utilize vBulletin's [thread] and [post] tags... So if I were to import them into XF, they would all not work anymore.

    But it also takes care of things like deleted posts or merged threads... let's say this thread was 5 pages long, and you were linking to a post manually which was on page 5... if some posts before it get deleted (or added via a merge), the post you linked to isn't on page 5 anymore... but your original link still links to page 5.

    So it's not *just* future proofing, but also if an existing post URL changes for whatever reason (different thread, different page, maybe you change the number of posts shown per page, etc.)
     
    Anthony Parsons likes this.
  8. Digital Doctor

    Digital Doctor Well-Known Member

    http://xenforo.com/community/threads/8wayrun-com-xenporta-portal.7586/
    So the thread number is 7568.
    so [thread=7568]Here is what you are looking for ...[/thread] would link to the xenporta thread.
    to find the 7568 number ... I had to use xenforo's search.
    tomorrow when I want to link to Xenporta again ... would I just repeat the search get the number again ... and use
    [thread=7568]Insert Text Here[/thread] ?
     
  9. ChemicalKicks

    ChemicalKicks Well-Known Member

    How does this appear on your forums, can someone link me?:)
     
  10. Digital Doctor

    Digital Doctor Well-Known Member

  11. James

    James Well-Known Member

    To find the thread id you just look at the digits at the end of the url. If you want to link it again you just use the same method.

    Download the addon and look at rendertagthread and rendertagpost, you'll see how it works.
     
  12. Digital Doctor

    Digital Doctor Well-Known Member

    Hmmmm ....
    Is there a SEO benefit to having Pages Numbers in the URL ?
    Seems like there is certainly some liability.

    I thought xenforo might be smarter at finding posts ...
    Forinstance ... this post is #201 (top of the page) in the Thread Prefixes thread.
    http://xenforo.com/community/threads/thread-prefixes.19936/page-11#post-257381
    If a post before it gets deleted, it will move to page 10 and be post #200.
    thus the URL
    http://xenforo.com/community/threads/thread-prefixes.19936/page-11#post-257381
    would fail.
    Can't Xenforo just find the location by knowing the post number ? Which doesn't change ?
    Would that be a performance problem ?
     
  13. digitalpoint

    digitalpoint Well-Known Member

    It can't find the post number based on that URL because the hash portion of the URL isn't passed to the server... so the server never sees "#post-257381"... you could read it with JavaScript and do a redirect that way, but that would be useless for SEO purposes.
     
    Digital Doctor likes this.
  14. Marcus

    Marcus Well-Known Member

  15. Digital Doctor

    Digital Doctor Well-Known Member

    When linking to a post ... it just seems ... well ... obvious to link to the post number. (Aren't post numbers permanent ?)
    http://xenforo.com/community/posts/257381 - seems like a good way.
    Xenforo has chose to link to Pages - not Posts.
    Is there a good rationale for the Page linking method ?
    SEO benefit ?
     
  16. Marcus

    Marcus Well-Known Member

    It is better for SEO if a page is linked by one link. If one page is linked by several links, this is not good. Keep it simple and easy.
     
Thread Status:
Not open for further replies.

Share This Page