Skip to content

Instantly share code, notes, and snippets.

@carlcs
Created December 8, 2017 17:04
Show Gist options
  • Save carlcs/acf7e14ee3393ec135a40a28493ac82a to your computer and use it in GitHub Desktop.
Save carlcs/acf7e14ee3393ec135a40a28493ac82a to your computer and use it in GitHub Desktop.
{% extends '_layouts/standard' %}
{% set cacheContentBlock = true %}
{% block content %}
{# ...content worth caching #}
{% endblock %}
{% extends '_layouts/base' %}
{% block layout %}
{% block navigation %}
{% cache globally using key 'site-navigation' %}
{% include '_includes/site/navigation' %}
{% endcache %}
{% endblock %}
<main>
{% set cacheContentBlock = cacheContentBlock ?? false %}
{% set cacheKey = cacheContentBlock is same as(true) ? 'content-' ~ entry.id : cacheContentBlock %}
{% cache globally using key cacheKey if cacheContentBlock %}
{% block content %}
{% endblock %}
{% endcache %}
</main>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment