Defining custom routes

General Discussion
  • Hello,

    About a week ago I stumbled upon NodeBB & thought to give it a try. I'd like to point out that I'm a beginner with the Node.js environment, so getting into it has been very difficult.
    Anyway, the reason why I'm posting here is that I can't figure out the way how to create custom routes to display dynamic forum content. So here is the scenario:

    I have the Vanilla theme installed & I've successfully edited the layouts to fit my needs. Now I'm stuck at the part where I need to create a new route (/forum) & assign it as a menu item. How can I achieve this? (Note: I've already added the href="{relative_path}/forum" value to one of my menu items. I've also created a new layout file called forum.tpl in the Vanilla templates directory as well.)
    Any help is much appreciated!

  • Hey there @markkus! How come you're trying to add a link to /forum? Shouldn't / already go to the home page?

  • href="{relative_path}/forum" is the value & it gives me a 404.

  • Custom routes are defined by plugins, since the routing actually has to be created by NodeBB.

    You'll need to write a plugin that listens for the action:app.load hook and calls a relevant method to add the routes


Suggested Topics