Which XF database tables store forums, topics and original slugs?

Per my post in the other thread, almost all slugs are generated dynamically at run-time. That is to say, for example, that the slug for this thread isn't stored in the database at all, it's generated directly from the title column itself.
 
For threads it would be the xf_thread table. It varies by entity. The gist of it is they wind up being ran through \XF\Mvc\Router::prepareStringForUrl(), which converts them into slugs.
 
For threads it would be the xf_thread table. It varies by entity. The gist of it is they wind up being ran through \XF\Mvc\Router::prepareStringForUrl(), which converts them into slugs.

I am curious, does this mean that the URL is NOT stored and is built on fly, for each request?
For performance, I would assume XF will store the URLs somewhere? Right?

Thanks.
 
I am curious, does this mean that the URL is NOT stored and is built on fly, for each request?
That's right.

For performance, I would assume XF will store the URLs somewhere? Right?
No, there's not really any important performance penalty with this approach. The important part is the ID (number) in the URL, the rest doesn't really matter as far as querying for the data goes:

https://xenforo.com/community/threads/i-just-made-this-up-right-now.174647/

You'll get redirected to the proper slug for canonicalization purposes, but the point remains.
 
Yup. If you change the title of a thread, you basically get a brand new URL for all the pages of that thread. This alone forced me to stop using title in slug. This feels pretty weird for someone who is used to how something like WP handles slugs!
 
Yup. If you change the title of a thread, you basically get a brand new URL for all the pages of that thread. This alone forced me to stop using title in slug. This feels pretty weird for someone who is used to how something like WP handles slugs!
The title is irrelevant for URL handling though and is there solely for readability. You can change the title text in a thread URL to whatever you want, as long as the ID is the same at the end of the URL it will resolve and even redirect to the new correct URL.
 
that's true. but i am not sure how good of an idea it is for 500 pages of a thread to get 500 new URLs if I made a small change to the title of that thread. that's 500 pages that google/etc would have to reindex and remove the old 500 urls from their index. wordpress is not a forum software but they decided for some reason that your blog post URL would not change (unless you want to) if you made a change to the title of a blog post.

though i guess the behavior is same as other major forum software like IPB or vB? i haven't used either in a while and I do not remember if they allow a slug option that is maintained even if you change the title of the thread?
 
that's true. but i am not sure how good of an idea it is for 500 pages of a thread to get 500 new URLs if I made a small change to the title of that thread. that's 500 pages that google/etc would have to reindex and remove the old 500 urls from their index. wordpress is not a forum software but they decided for some reason that your blog post URL would not change (unless you want to) if you made a change to the title of a blog post.

though i guess the behavior is same as other major forum software like IPB or vB? i haven't used either in a while and I do not remember if they allow a slug option that is maintained even if you change the title of the thread?
The forum sends a redirect code to the bot when it attempts the URL, thereby updating the search engine's cached URL to the new one. Google and other engines are much smarter than simply removing an old entry for a page a creating a new one, forgetting about the old one. This isn't 1995.

wordpress is not a forum software but they decided for some reason that your blog post URL would not change (unless you want to) if you made a change to the title of a blog post.
The wordpress URL won't change because it's keyed to the unique identifier of the post. That's a decision made long long ago and the pain it causes internally for updating meta data and links is terrible. There are good and bad reasons for either method but IMO there are far too many downsides to a unique title slug identifier.

The main point is that you shouldn't worry about thread titles and URLs, it's a problem solved long ago.
 
Top Bottom