Understanding the templating engine & middleware



  • Ok, this may be obvious, but I just don't see it...

    Why does the navbar (menu bar) not load on the login page?

    It looks like it's set up the same way as the other routes & templates which means header.tpl would load which in turn would also load partials/menu.tpl.

    What am I missing here?

    EDIT: Maybe it's not so obvious after all...?


  • Admin

    The partials/menu.tpl has bunch of IF statements so it doesn't render some parts if user is not logged in. For example on the login page. https://github.com/NodeBB/nodebb-theme-vanilla/blob/master/templates/partials/menu.tpl#L85-L172



  • Ya, so I was dumb...I have a local dev instance and a staging server. I was playing around with some things and forgot to switch the theme back to vanilla which explains why I was missing the navbar for the login screen...boo me.

    But yes, thanks for pointing that out. The template engine and middleware are making a lot more sense now after looking through the source for the last 2 days...

    I'm going to start looking to add/update the documentation here soon...some of the stuff can drive you crazy if you aren't familiar with the version changes.

    Also, after reading through most of core at this point I have to say it's an impressive piece of kit. Thumbs up to the core devs. @julian @baris @psychobunny

    EDIT: Also, anyone else who comes across this thread...if you really want to save yourself some time banging your head against the wall -- like I did -- take a few days to really dive into the nodebb source. It has been a good lesson in object-oriented javascript -- so many objects 🙂 -- done right. I've realized I'm approaching things more from a functional perspective, so this has been an eye opener for me.




Looks like your connection to NodeBB was lost, please wait while we try to reconnect.