Last active
April 8, 2018 02:23
-
-
Save croxton/cea020d5e9c5ee77192c to your computer and use it in GitHub Desktop.
Related entries fragment inside cached
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exp:stash:cache} | |
{exp:channel:entries limit="1" ...} | |
{!-- related entries --} | |
{stash:nocache} | |
{exp:stash:set_list | |
name="st_fbox_rels" | |
context="@URI" | |
bundle="related_items" | |
parse_tags="yes" | |
parse_depth="2" | |
save="yes" | |
scope="site" | |
replace="no" | |
} | |
{exp:playa:children | |
entry_id="{/stash:nocache}{entry_id}{stash:nocache}" | |
channel="my_channel" | |
field="cf_editorial_rel" | |
var_prefix="related" | |
disable="member_data|pagination|categories" | |
} | |
{stash:st_rel_title}{related:title}{/stash:st_rel_title} | |
{stash:st_rel_url}{related:page_url}{/stash:st_rel_url} | |
{/exp:playa:children} | |
{/exp:stash:set_list} | |
{/stash:nocache} | |
{/exp:channel:entries} | |
{stash:nocache} | |
{!-- Related links --} | |
{exp:stash:get_list name="st_fbox_rels" context="@URI" bundle="related_items" process="end"} | |
{if '{count}' == '1'} | |
<div class="fbox group"> | |
<header> | |
<h3 class="fbox__heading">{exp:stash:st_rel_label default="Related links"}</h3> | |
</header> | |
<ul class="fbox__list"> | |
{/if} | |
<li><a href="{st_rel_url}">{st_rel_title}</a></li> | |
{if '{count}' == '{total_results}'} | |
</ul> | |
</div> | |
{/if} | |
{/exp:stash:get_list} | |
{/stash:nocache} | |
{/exp:stash:cache} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment