<p>If your putting the variable in the craft settings input, try wrapping it in single brackets like <code>{siteUrl}</code> instead of <code>{{ siteUrl }}</code></p>

<p>That should do the trick</p>

CC BY-SA 3.0
2014-11-18T14:38:11.030Z
Sorry, forgot to come back here when I fixed it, yeah this was partially the problem, I was trying to do this through my asset sources too (then realised I could just reference them relative). Thanks!
Lighty_46
CC BY-SA 3.0
2014-11-15T14:33:15.950Z
2014-11-15T14:33:15.950Z
Alec Ritson
<p>I'm guessing you're defining your siteUrl as an environment variable?</p>

<p>Try setting it as the actual <a href="http://buildwithcraft.com/docs/config-settings#siteUrl" rel="nofollow">siteUrl config setting</a>, rather than a <a href="http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables" rel="nofollow">siteUrl environment variable</a>.</p>

<p>See <a href="https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921">here</a> for an explanation.</p>

CC BY-SA 3.0
2014-11-14T00:09:37.260Z
Yeah I did have it set up as an environment variable (And I am able to output the website url using {{ siteUrl }} so that's working fine) ... but I added in the config setting too and that hasn't made a difference. The link still appears as `<a href="{{ siteUrl }}/resources/images/image.jpg">link</a>`
Lighty_46
CC BY-SA 3.0
2014-11-14T00:21:57.417Z
When you added the config setting, did you remove the environment variable?
Brad Bell
CC BY-SA 3.0
2014-11-14T00:01:54.730Z
2014-11-14T00:01:54.730Z
Brad Bell
<p>I haven't used Craft in a while now and I have just revisited it, I'm trying to output an image URL from a global matrix field like so:</p>

<pre><code>{% for block in globalName.matrixField %}

    {% if block.type == "blockType1" %}

        {% set image = block.blockType1.first() %}

        &lt;a href="{{ image.getUrl() }}"&gt;link&lt;/a&gt;

    {% endif %}

{% endfor %}
</code></pre>

<p>But it keeps outputting as: <code>{{ siteUrl }}/resources/images/my-image.jpg</code> (instead of actually outputting the website URL).</p>

<p>Am I missing something?</p>

<matrix><globals>
.getUrl() outputting {{ siteUrl }} in address
# .getUrl() outputting {{ siteUrl }} in address

(Asked by: username_0 on 2014-11-13)

I haven't used Craft in a while now and I have just revisited it, I'm trying to output an image URL from a global matrix field like so:
{% for block in globalName.matrixField %}

    {% if block.type == "blockType1" %}

        {% set image = block.blockType1.first() %}

        link

    {% endif %}

{% endfor %}

But it keeps outputting as: {{ siteUrl }}/resources/images/my-image.jpg (instead of actually outputting the website URL).
Am I missing something?

**Tags:** matrix, globals

---

## 2 answers

### Answer by username_1 on 2014-11-15. Score: 3 | Accepted answer

If your putting the variable in the craft settings input, try wrapping it in single brackets like `{siteUrl}` instead of `{{ siteUrl }}`

That should do the trick

> **Comments:**
> **username_0**: Sorry, forgot to come back here when I fixed it, yeah this was partially the problem, I was trying to do this through my asset sources too (then realised I could just reference them relative). Thanks!  

---

### Answer by username_2 on 2014-11-14. Score: 1

I'm guessing you're defining your siteUrl as an environment variable?

Try setting it as the actual [siteUrl config setting](http://buildwithcraft.com/docs/config-settings#siteUrl), rather than a [siteUrl environment variable](http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables).

See [here](https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921) for an explanation.

> **Comments:**
> **username_0**: Yeah I did have it set up as an environment variable (And I am able to output the website url using {{ siteUrl }} so that's working fine) ... but I added in the config setting too and that hasn't made a difference. The link still appears as `<a href="{{ siteUrl }}/resources/images/image.jpg">link</a>`  
> **username_2**: When you added the config setting, did you remove the environment variable?  

---

