How to define partial views in node.js with Express 2.5

I need to define the skeleton for my node.js app with a menu that needs to be different for logged and anonymous user.

I think that the correct way should be the use of partials (i use Express 2.5) but i don't know how to pass data from the app and the partial. Do i need to add a condition in the layout to embed loggedPartial.ejs or anonymousPartial.ejs?

I'm sure there must be a cleaner way to do it.

In your route:

res.render('main', { menu : 'loggedPartial' }); // or 'anonymousPartial'

Your main template:

<%- partial(menu) %>

No need to use a conditional statement, menu is expanded dynamically during rendering.