Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: Escape doesn’t work - using ee layouts
Status | Resolved |
Add-on / Version | Speedy 1.3.0 |
Severity | |
EE Version | 5.3.2 |
Francesco Pensabene
Nov 30, 2020Test example:
Layout content:
{layout="_layout/_test"}
{exp:speedy:fragment key="test-template"}
{exp:speedy:escape}
{layout:set name='title'}Test Title{/layout:set}
{layout:set name='meta_description'}Test Meta Desc{/layout:set}
{/exp:speedy:escape}
<h1>This is the page content</h1>
<p>{/exp:speedy:fragment}
Template using the layout:
{exp:speedy:fragment key="test-layout" global="yes"}
<!doctype html>
<html class="no-js" lang="it">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{exp:speedy:escape}{if layout:title}{layout:title}{if:else}WorldBridge{/if}{/exp:speedy:escape}</title>
<meta name="description" content="{exp:speedy:escape}{layout:meta_description}{/exp:speedy:escape}">
</head>
<body>
{exp:speedy:escape}{layout:contents}{/exp:speedy:escape}
</body>
</html>
{/exp:speedy:fragment}
This is the global cached layout:
as you can see the 2 variables template tags disapeared and are already substituted by content
1606742330
1606745930
{!-- ra:000000001cc2a5450000000006a54c16 --}<!doctype html>
<html class="no-js" lang="it">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Title</title>
<meta name="description" content="Test Meta Desc">
</head>
<body>
{layout:contents}
</body>
</html>
This is the cached template file
1606742330
1606745930
{!-- ra:000000001cc2a56c0000000006a54c16 --}{layout:set name='title'}Test Title{/layout:set}
{layout:set name='meta_description'}Test Meta Desc{/layout:set}
<h1>This is the page content</h1>
with this behaviour title and meta description always remain the one of the first template rendered with the layout.
BoldMinded (Brian)
Its not working because you’re trying to use the {layout:*} vars, other than {layout:content}, inside the fragment tag, which does not work. Take a look at the docs, which I updated, and tested locally to confirm it works as documented. https://docs.boldminded.com/speedy/docs/tags#template-layouts