<p>What if you just use <code>&lt;a href="{{ file.url }}"&gt;</code>? So, without the siteUrl part? If your Asset source's URL setting is correct (so, the complete url, preferably using {siteUrl}), that should do the trick ...</p>

CC BY-SA 3.0
2015-03-23T20:10:07.140Z
I tried that, but it only returns the file path, like `/public/assets/sdfsdfds.jpeg` without the website url.
Marlon Marcello
CC BY-SA 3.0
2015-03-23T20:20:28.973Z
And what's your assets source's URL setting?
Paul
CC BY-SA 3.0
2015-03-23T20:25:06.850Z
File System Path: {basePath}/assets/uploads/

URL: /public/assets/uploads/
Marlon Marcello
CC BY-SA 3.0
2015-03-23T20:33:44.640Z
Url should be the complete url to your file, so for instance {siteUrl}public/assets/uploads. That way, {{ file.url }} always works, even if you change the siteUrl config setting.
Paul
CC BY-SA 3.0
2015-03-23T21:00:23.903Z
Ohh man, that's it. Haha. Thanks for your time @paul-verheul appreciate that. You might wanna add that to your answer for future reference. Thanks again.
Marlon Marcello
CC BY-SA 3.0
2015-03-23T20:02:00.287Z
2015-03-23T21:01:54.250Z
2015-03-23T21:01:54.250Z
Paul
<p>I'm trying to send some assets links through email, but using <code>{{ siteUrl  ~ file.link }}</code> returns an url with double forwards slashes like: <code>http://example.com//public/assets/sdfsdfds.jpeg</code></p>

<p>I couldn't find a method on the <strong>AssetsFileModel</strong> that generates a direct link to it. Is there an easy way to do this?</p>

<p>Thanks!</p>

<templating><assets>
Direct link to asset
# Direct link to asset

(Asked by: username_0 on 2015-03-23)

I'm trying to send some assets links through email, but using `{{ siteUrl ~ file.link }}` returns an url with double forwards slashes like: `http://example.com//public/assets/sdfsdfds.jpeg`

I couldn't find a method on the **AssetsFileModel** that generates a direct link to it. Is there an easy way to do this?

Thanks!

**Tags:** templating, assets


---

## 1 answers

### Answer by username_1 on 2015-03-23. Score: 3 | Accepted answer

What if you just use ? So, without the siteUrl part? If your Asset source's URL setting is correct (so, the complete url, preferably using {siteUrl}), that should do the trick ...

> **Comments:**
> **username_0**: I tried that, but it only returns the file path, like `/public/assets/sdfsdfds.jpeg` without the website url.  
> **username_1**: And what's your assets source's URL setting?  
> **username_0**: File System Path: {basePath}/assets/uploads/  URL: /public/assets/uploads/  
> **username_1**: Url should be the complete url to your file, so for instance {siteUrl}public/assets/uploads. That way, {{ file.url }} always works, even if you change the siteUrl config setting.  
> **username_0**: Ohh man, that's it. Haha. Thanks for your time @paul-verheul appreciate that. You might wanna add that to your answer for future reference. Thanks again.  

---

