How do I include a shared header without losing local variables?
I set a page title before including a shared header. Should the header be able to read it?
Accepted answer by accepted-answer
Yes. Includes are normally used with the surrounding request context, so a shared header can read locals that were set before the include. This is how many Lasso layouts pass titles, navigation state, and notices.
1local(page_title) = 'Media'2include('/includes/header.lasso')If the same notice renders twice, check whether both the included header and the page body output it.
Answer by layout-admin
For larger sites, put shared rendering in methods and keep only layout structure in include files.
1define render_title(title::string) => '<h1>' + #title->encodeHtml + '</h1>'Do not rely on different variable casing to store different values.