You can set the variable on specific paths using the page helper:
page "/my-page.html", :locals => { :is_logged_in => true }
If you want to use a single template that includes an if to handle changes to content based on is_logged_in , you should use page proxies:
page "/my-page-logged-in.html", :proxy => "/my-page.html", :locals => { :is_logged_in => true } page "/my-page-logged-out.html", :proxy => "/my-page.html", :locals => { :is_logged_in => false }
For direct variables, use set :
set :is_logged_in, true
In the template:
<%= is_logged_in %>
source share