Remove Category/Topic Names From Url

NodeBB Development
  • #1

    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!


    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.

  • GNU/Linux

    @Laz You can use JS replace() function! You just need to find a regex that works with all the pages and put your code on Custom JavaScript on ACP.

    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 = ''
    url = url.replace('/nodebb-development','')
    console.log(url) // output: ""
  • #3

    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:
    # This would jump me to this post.
    # This would not.
  • GNU/Linux

    @Laz Oh, I see... I don't know any solution, sorry.

  • #5

    Bumping this, as I'm still searching for a solution.

  • Global Moderator Plugin & Theme Dev

    There's no way to do this without a lot of manual changes to the source code

  • #7

    @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?

  • Global Moderator Plugin & Theme Dev

    @Laz there is no easy or straightforward way, no

Suggested Topics

  • 0 Votes
    4 Posts

  • Remove all bookmarks

    NodeBB Development
    0 Votes
    12 Posts

  • 6 Votes
    14 Posts

  • 0 Votes
    5 Posts

  • 1 Votes
    3 Posts

| | | |