summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/resources/Copy.md
blob: 220a3db4ce9b52d311a98678f17c2aea5c57d5ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
title: resources.Copy
description: Copies the given resource to the target path.
categories: []
params:
  functions_and_methods:
    aliases: []
    returnType: resource.Resource
    signatures: [resources.Copy TARGETPATH RESOURCE]
---

```go-html-template
{{ with resources.Get "images/a.jpg" }}
  {{ with resources.Copy "img/new-image-name.jpg" . }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}
```

The relative URL of the new published resource will be:

```text
/img/new-image-name.jpg
```

> [!note]
> Use the `resources.Copy` function with global, page, and remote resources.