I have a couple of formats that a news story can display on the site. I have each of these as a different Stash embed.
They're named in this format: story-block
, story-focal
, story-standard
.
The site is in a magazine format and so uses many different styles on one page, often mix and matching them.
For example, on the homepage it loads in 16 blog posts, the first 4 are in story-block
format, the next 6 are in story-standard
format and the final is in story-block
format.
The following code doesn't work, but demonstrates the concept I'm trying to achieve.
<div class="two-by">
{exp:stash:get_list name="news" limit="4"}
{exp:stash:embed:modules:story-block process="start"}
{/exp:stash:get_list}
</div>
{exp:stash:get_list name="news" limit="6" offset="4"}
{exp:stash:embed:modules:story-standard}
{/exp:stash:get_list}
{exp:stash:get_list name="news" limit="1" offset="10"}
{exp:stash:embed:modules:story-block}
{/exp:stash:get_list}
story-block
has the following markup:-
<article class="story story--block">
<a href="{url}">
<img src="{photo}">
<div class="story__details">
<h2 class="main-title">{title}</h2>
{excerpt}
<div class="mini-meta">
<span>{type}</span>
<span>{date}</span>
</div>
</div>
</a>
</article>
But when rendered it doesn't load in the data, it will still show {title}
.
My inkling is that embedding with process="start"
should do the trick as it would then work as an EE snippet would, but this doesn't make a difference.
If I don't embed and instead copy the code directly into the template it works fine - but this is going to lead to massive code duplication around the site.
Is this possible, or is there a workaround?
{exp:stash:embed name="modules:story-block" stash:title="{title}"}
it works, but I feel like that is an unnecessary step and there is probably a parameter to share the same vars as where it was called from (as a snippet would vs this embed-like method)