| 1 |
--- |
| 2 |
title: resources.Copy |
| 3 |
description: Copies the given resource to the target path. |
| 4 |
categories: [] |
| 5 |
params: |
| 6 |
functions_and_methods: |
| 7 |
aliases: [] |
| 8 |
returnType: resource.Resource |
| 9 |
signatures: [resources.Copy TARGETPATH RESOURCE] |
| 10 |
--- |
| 11 |
|
| 12 |
```go-html-template |
| 13 |
{{ with resources.Get "images/a.jpg" }} |
| 14 |
{{ with resources.Copy "img/new-image-name.jpg" . }} |
| 15 |
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> |
| 16 |
{{ end }} |
| 17 |
{{ end }} |
| 18 |
``` |
| 19 |
|
| 20 |
The `TARGETPATH` is relative to the server root. A leading slash is optional and has no effect. |
| 21 |
|
| 22 |
> [!NOTE] |
| 23 |
> Use the `resources.Copy` function with global, page, and remote resources. |