Skip to content

Deprecation: layout tag

Bhavin Patel edited this page Dec 26, 2018 · 3 revisions

The layout tags have been deprecated in favor of using <${dynamic}/> as shown below:

<layout-use> → Layout components with <@tags> (or import)

Old:

<layout-use('../../layouts/site-layout.marko')>
    <layout-put into="body">
        Hello World
    </layout-put>
</layout-use>

New:

import SiteLayout from '../../layouts/site-layout.marko';

<${SiteLayout}>
    <@body>
        Hello World
    </@body>
</>

New (Recommended):

<site-layout>
    <@body>
        Hello World
    </@body>
</site-layout>

Related Docs: http://markojs.com/docs/custom-tags/#writing-custom-tags

<layout-placeholder><${dynamic}>

Old:

<!doctype>
<html>
<body>
    <layout-placeholder name="body">
        Default body content
    </layout-placeholder>
</body>
</html>

New:

<!doctype>
<html>
<body>
    <if(input.body)>
        <${input.body}/>
    </if>
    <else>
        Default body content
    </else>
</body>
</html>
Without fallback content

Old:

<!doctype>
<html>
<body>
    <layout-placeholder name="body"/>
</body>
</html>

New:

<!doctype>
<html>
<body>
    <${input.body}/>
</body>
</html>

Related Docs: http://markojs.com/docs/core-tags/#layouts-with-nested-attributes