@Baerrus oh ok thank you 🙂
Remove Category/Topic Names From Url
Heya. I'm just getting started with NodeBB and am enjoying my experience thus far, I find it very customisable and am enjoying slowly making my own theme as part of a learning curve. I was wondering if it was possible to remove the category and topic names from the urls and just rely entirely on their IDs. I'm no stranger to working with JS, so if some of that is required, just some pointers would do!
https://YourUrl.com/category/3/nodebb-development becomes https://YourUrl.com/category/3/ and https://YourUrl.com/topic/2/very-long-test-thread-name-you-get-the-idea becomes https://YourUrl.com/topic/2/
I obviously know that you can just crop out the text from the url manually, and it will still send you to the right place, I was just wanting to remove that step so that any user visiting the page would just see the shortened versions, not the really long text filled urls.
Thanks in advance.
object.replace('[regex for what you want to be replaced]','[new string to be replaced there]')
So, your new string should be empty ('') to hide the category/topic name.
Eg. for one page only (because I'm not so good with regex yet ) :
var url = 'https://YourUrl.com/category/3/nodebb-development' url = url.replace('/nodebb-development','') console.log(url) // output: "https://YourUrl.com/category/3"
Laz last edited by Laz
Heya @jtsimoes. The main issue with this approach is that it would disabled post jumping (i.e. if you add a /3 on the end of a topic url, for example, it would jump you to the third post). Also when people directly link to topic it'll still carry the full url.
Edit for example:
https://community.nodebb.org/topic/13917/remove-category-topic-names-from-url/3 # This would jump me to this post. https://community.nodebb.org/topic/13917/3 # This would not.
@Laz Oh, I see... I don't know any solution, sorry.
Bumping this, as I'm still searching for a solution.
There's no way to do this without a lot of manual changes to the source code
@PitaJ While researching this, I noticed that all posts and topics then when used will jump to them. In my case, my last post was:
Is there a way to replace all the text based urls with that instead?
@Laz there is no easy or straightforward way, no