I'm rendering some HTML into a variable. On this HTML I want to replace a value using craft.request.getUrl()
but the value doesn't seem to get replaced. Any idea what I'm doing wrong?
{% set pages %}
{% set entries = craft.entries.section('pages') %}
{% for entry in entries %}
<a href="{{ entry.url }}" data-url="{{ entry.url }}">{{ entry.title }}</a>
{% endfor %}
{% endset %}
{{ pages|replace({'data-url="{{ craft.request.getUrl() }}"': 'class="active"'})|raw }}