Outputting siteUrl consumes next closing tag I'm running Craft Pro 2.3.2640.

Here is the code:

&lt;span&gt;{{ siteUrl }}&lt;/span&gt;


Here is the output:

//localhost:3001/%3C/span%3E


The opening tag stays intact.

I am also struggling to use this variable with functions like "replace" when I need to parse the referral url.
Try to set the siteUrl in config/general.php like so.

return array(
    '*' =&gt; array(
    ),
    'localhost' =&gt; array(
        'siteUrl' =&gt; 'http://localhost:3001/',
    ),
);


And then apply your replace filter.

&lt;span&gt;{{ siteUrl|replace({'localhost:3001': 'mysite.com'}) }}&lt;/span&gt;