# Cache Expensive Assigns

Assign filtered/transformed values once, then reuse. Avoid repeating Liquid filters on the same data.

```liquid
{% comment %} BAD: escape runs twice {% endcomment %}
<a href="{{ product.url | within: collection }}">{{ product.title | escape }}</a>
<span>{{ product.title | escape }}</span>

{% comment %} GOOD: assign once, reuse {% endcomment %}
{% assign product_title = product.title | escape %}
{% assign product_url = product.url | within: collection %}

<a href="{{ product_url }}">{{ product_title }}</a>
<span>{{ product_title }}</span>
```
