New Route For Home Page

Plugin Development
  • HI guys.. im looking over nodebb code so i could have a clue how to write down a plugin that can retrive all categories and recent topics.

    I found the the methods that return that data..


    also found the hook to the homepage


    i was thinking about adding another register on this filter for a custom route but how i can create another route without messing around the core code, and return a json array with those 2 methods return?

    any leads or maybe this idea is too much and there is something more elegant and simple? 🙂

  • In your plugins init method you can do

    var helpers = module.parent.require('./routes/helpers');
    myPlugin.init = function(params, callback) {
        helpers.setupPageRoute(, '/', params.middleware, [], myCustomHome);
    function myCustomHome(req, res, next) {
             categories: function(next) {
             topics: function(next) {
        }, function(err, results) {
             res.render('myCustomTemplate', results);

    I left out some of the params for the 2 methods you mentioned. Let me know if you can't figure it out.

Suggested Topics