Is there an alternate way to pass embed variables other than passing them as attributes?

  • You know you can put a complete module tag inside a parameter of an embed, right?
    – Sobral
    Commented Nov 14, 2013 at 10:39

1 Answer 1


Not natively I believe.

I typically use Stash to do this nowadays. It will give you persistent variables as well as template inheritance so you can do things like this.

Wrapper template

<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" lang="en"><!--<![endif]-->


    <meta charset="utf-8" />
    <link rel="dns-prefetch" href="//use.typekit.com" />

    {if "{exp:stash:not_empty name='st_html_title'}"}<title>{exp:stash:get name="st_html_title"} - Site name</title>{if:else}<title>Site name</title>{/if}

    <meta name="viewport" content="width=device-width" />

    <link rel="shortcut icon" href="{site_url}/favicon.ico" />

    <link rel="stylesheet" media="screen" href="{site_url}/assets/css/screen.css" />


    <div id="maincontent" role="main">

        {!-- built wisth stash and template partial approach--}
        {exp:stash:get name="content"}



Partial template

{!-- Layout used --}

{!-- Meta data --}
{exp:stash:set name="st_html_title"}Products{/exp:stash:set}

{!-- Build list --}
{exp:stash:set_list name="st_products_list"}
    {exp:channel:entries disable="categories|category_fields|member_data|trackbacks" channel="products" status="open" orderby="date" sort="desc" limit="10"}

{!-- Build page content --}
{exp:stash:set name="content"}

    {exp:stash:get_list name="st_products_list" prefix="stashprefix"}

        {if count == "1"}<ul>{/if}
                <h2><a href="{st_url}">{st_title}</a></h2>
        {if count == total_results}</ul>{/if}

        {!-- if no results --}
        {if stashprefix:no_results}<p>No Products Found</p>{/if}



It takes a bit of time to wrap your head around that approach but it is worth it IMHO. Here are a few resources to get you started:

  • I can't use {stash:embed} unfortunately. Commented Nov 28, 2013 at 7:52
  • Regular embeds would work just fine as well. Commented Mar 11, 2014 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.