I have a Middleman project and I need to emulate a logged-in user.
Simple enough – would be fine to set some global variable like @user = 1 in config.rb, code everything for the logged-in user, then set the variable to 0 and code everything for the logged-out user putting if’s everywhere
I’m not a Ruby coder so I don’t understand where to hook in.
So: how can I set a global app variable in a middleman’s config.rb?
You can set variable on specific paths using the
pagehelper:If you wanted to use a single template, which include an
ifstatement to handle content changes based onis_logged_in, you would use a page proxy:For direct variables, use
set:In template: