Last active
April 8, 2018 02:23
-
-
Save croxton/94e163488ca76102e8aa to your computer and use it in GitHub Desktop.
Stash caching example 2
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
{!-- ============================================================================ --} | |
{!-- CONTENTS OF pages/index --} | |
{!-- ============================================================================ --} | |
{exp:stash:cache context="{global:env}" bundle="pages" replace="{global:stash_cache_replace}"} | |
{!-- embed the base layout --} | |
{stash:embed:view} | |
{!-- extend the content block in the 'view' template with a custom layout --} | |
{exp:stash:extend name="content" with="partials:my_partial"} | |
{!-- capture data --} | |
{exp:channel:entries | |
channel="pages" | |
limit="1" | |
disable="categories|member_data|pagination" | |
} | |
{exp:stash:set type="snippet"} | |
{stash:content_title}{title}{/stash:content_title} | |
{stash:content_entry_id}{entry_id}{/stash:content_entry_id} | |
{stash:content_channel_id}{channel_id}{/stash:content_channel_id} | |
{/exp:stash:set} | |
{/exp:channel:entries} | |
{/exp:stash:cache} | |
{!-- ============================================================================ --} | |
{!-- CONTENTS OF stash_templates/view --} | |
{!-- ============================================================================ --} | |
<html> | |
<body> | |
{stash:content} | |
</body> | |
</html> | |
{!-- ============================================================================ --} | |
{!-- CONTENTS OF stash_templates/partials/my_partial --} | |
{!-- ============================================================================ --} | |
<h1>{content_title}</h1> | |
{stash:nocache} | |
{exp:edit_this:entry {/stash:nocache}entry_id="{content_entry_id}" channel_id="{content_channel_id}"{stash:nocache}} | |
<a href="{edit_this_url}">Edit this</a> | |
{/exp:edit_this:entry} | |
{/stash:nocache} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment