• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • 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

Status
Not open for further replies.

digitalpoint

Well-known member
#1
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".
 

Attachments

Digital Doctor

Well-known member
#2
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 ?
 

Digital Doctor

Well-known member
#3
It allows you to link to a specific thread/post and the link will change if the URL structure ever changes.
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 ?
 

digitalpoint

Well-known member
#4
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.
 

Digital Doctor

Well-known member
#5
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.
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 ?
 

James

Well-known member
#6
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 ?
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.
 

digitalpoint

Well-known member
#7
Is the purpose mostly for future proofing links ?
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.)
 

Digital Doctor

Well-known member
#10

James

Well-known member
#11
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] ?
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.
 

Digital Doctor

Well-known member
#12
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.
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 ?
 

digitalpoint

Well-known member
#13
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.
 
Status
Not open for further replies.