Skip to content

Commit

Permalink
Global cache on pages and blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bymayo committed Oct 3, 2018
1 parent f1dc8ce commit 2824050
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
8 changes: 4 additions & 4 deletions templates/_blocks/block.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% cache globally using block.id %}
{% minify %}
{% endminify %}
{% endcache %}
{%- cache globally using key 'block-' ~ block.id -%}
{%- minify -%}
{%- endminify -%}
{%- endcache -%}
10 changes: 10 additions & 0 deletions templates/_layout/global.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@

{# Header #}

{%- cache globally using key 'site-header' -%}
{%- minify -%}
{%- endminify -%}
{%- endcache -%}

{% block content %}
{% endblock %}

{# Footer #}

{%- cache globally using key 'site-footer' -%}
{%- minify -%}
{%- endminify -%}
{%- endcache -%}

{% endblock %}
18 changes: 9 additions & 9 deletions templates/_page/types/page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
{# ------- Template ------- #}

{% block content %}

{% cache %}
{#
{% for block in entry.matrix %}
{% include '_blocks/' ~ block.type %}
{% endfor %}
#}
{% endcache %}

{%- cache globally using key 'site-footer' -%}
{%- minify -%}
{#
{% for block in entry.matrix %}
{% include '_blocks/' ~ block.type %}
{% endfor %}
#}
{%- endminify -%}
{%- endcache -%}
{% endblock %}

{# ------- Critical ------- #}
Expand Down

0 comments on commit 2824050

Please sign in to comment.