I'm migrating content from an old Craft 2 site (2.6.2985) to a new Craft 3 site. Cannot do a strait upgrade for various reasons.
I've started to set up an XML feed to use Feedme with. I am running into one issue where the body redactor field has a lot of images in it and I want do a find and replace to remove the absolute url and replace with a relative url so images will load on the front end.
My code:
<root>
{% for entry in craft.entries.section('articlesAndExcerpts').status('not foo').limit(1) %}
<entry>
<title><![CDATA[{{ entry.title }}]]></title>
{# more fields here #}
<body><![CDATA[{{ entry.body|replace('src="https://memoirs.azrielifoundation.org/': 'src="/'}) }}]]></body>
</entry>
{% endfor %}}
</root>
With without the |replace('')
filter everything is good. However when I use the replace filter it replaces the url as expected but at the same time creates a lot of html entities, like this:
How can I prevent this from happening and still do a find/replace on the image urls?