Cache entry but escape dynamic data How can I cache an entry, lets say a product card but exclude an dynamic part? Like amount of favorites / Or link to add or remove to favorite.

{% set item = craft.shortlist.item(entry.id) %}

{% cache globally using key "product-card-" ~ entry.id until entry.dateUpdated %}

   ...

   {{ entry.title }}

   ...

   // EXCLUDE THIS PART FROM CACHE
   {% if item.inList %}
        &lt;a class="love animating fav" href="{{ item.removeActionUrl }}" data-id="{{ entry.id }}"&gt;&lt;i class="icon icon-heart"&gt;&lt;/i&gt;&lt;/a&gt;
    {% else %}
        &lt;a class="love animating" href="{{ item.addActionUrl }}" data-id="{{ entry.id }}"&gt;&lt;i class="icon icon-heart"&gt;&lt;/i&gt;&lt;/a&gt;
    {% endif %}

{% endcache %}


In EE CE Cache there you had {exp:ce_cache:escape}. How can I do this in Craft?

Made a feature request for escaping parts of cache for dynamic data.

http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7412950-exclude-cache-for-dynamic-data

PLEASE VOTE :-)
You would simply not wrap it in cache tags. I don't think there's anything like that EE function to specifically exclude parts within the tag. Might be worth a feature request though?

{% set item = craft.shortlist.item(entry.id) %}

{% cache globally using key "product-card-" ~ entry.id ~ "-1" until entry.dateUpdated %}

    {{ entry.title }}

    ...

{% endcache %}

// EXCLUDE THIS PART FROM CACHE
{% if item.inList %}
    &lt;a class="love animating fav" href="{{ item.removeActionUrl }}" data-id="{{ entry.id }}"&gt;&lt;i class="icon icon-heart"&gt;&lt;/i&gt;&lt;/a&gt;
{% else %}
    &lt;a class="love animating" href="{{ item.addActionUrl }}" data-id="{{ entry.id }}"&gt;&lt;i class="icon icon-heart"&gt;&lt;/i&gt;&lt;/a&gt;
{% endif %}

{% cache globally using key "product-card-" ~ entry.id ~ "-2" until entry.dateUpdated %}

    ...

{% endcache %}