Idea: Different homepage for authenticated users

Feature Requests
  • It would be useful to be able to set a different homepage for logged-in users.

    So for example, example.com might display the category list for users who are logged-out and for users who are logged-in, example.com will display the list of recent topics.

  • This can be easily done with a plugin.

    Use the static:app.preload hook and add a middleware to the express object. Something like below.

    myPlugin.onPreLoad = function(data, callback) {
      data.app.use(function(req, res, next) { 
        if (req.path.startsWith('/') || req.path.startsWith('/api')) {
           if (req.uid) { 
              helpers.redirect(res, '/recent');
           } else {  
              helpers.redirect(res, '/categories');
           }
        } else {
           next();  
        }
      });
      callback();  
    };
    


Suggested Topics