I'm trying to make sure I understand the scope of {layout:set} variables, compared to how embeds work.
Traditionally, variables set with an {embed="template_group/template variable="foo"}
are only accessible one level deep, directly within the embedded template.
Now let's talk layouts.
We have at minimum 2 layout templates: layouts/global
& layouts/master
.
For the sake of this questions, let's say I have a blog/index
template that extends layouts/master
and layouts/master
extends layouts/global
blog/index:
{layout="layouts/master"}
{layout:set name="title"}Blog Title | {site_name}{/layout:set}
{exp:channel:entries channel="blog"}
All the blog content here...
{/exp:channel:entries}
layouts/master:
{layout="layouts/global"}
{embed="embeds/masthead"}
{layout:contents}
{embed="embeds/footer"}
layouts/global:
<html>
<head>
<title>{layout:title}</title>
</head>
<body>
{layout:contents}
</body>
</html>
The question I'd like clarity on (that my tests confirm) is this: Will the the {layout:title} variable be available within the layouts/global
template regardless of where it's set, or do I have to redefine it within the layouts/master
template, the way that you have to do if you were nesting embeds and passing variables?