Rakesh Tholiya Rakesh Tholiya - 8 months ago 26
Node.js Question

Node js how to create dynamic path

I want path like "left_sidebar/{user_role}"

{{> layout/left_sidebar/(here_user_role)}}

I have user role in session


So how can i create path like "left_sidebar/admin"


Try with this

var app = express();
app.set('view engine', 'hbs');
app.engine('hbs', exphbs({
    helpers: {
        role_base_partial : function (path,name) {
            return path + name;

In your View file

{{> (role_base_partial 'layout/left_sidebar/' role_name) }}