0

I'm running Craft Pro 2.3.2640.

Here is the code:

<span>{{ siteUrl }}</span>

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.

1
  • Do you set it in config/general.php and why do you omit the "http:" part?
    – carlcs
    Mar 18, 2015 at 11:06

1 Answer 1

2

Try to set the siteUrl in config/general.php like so.

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

And then apply your replace filter.

<span>{{ siteUrl|replace({'localhost:3001': 'mysite.com'}) }}</span>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.