mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Add source/target warning to resources.Copy (#2091)
This commit is contained in:
@@ -124,10 +124,19 @@ Remote resources fetched with `resources.GetRemote` will be cached on disk. See
|
|||||||
`resources.Copy` allows you to copy almost any Hugo `Resource` (the one exception is the `Page`), possibly most useful for renaming things:
|
`resources.Copy` allows you to copy almost any Hugo `Resource` (the one exception is the `Page`), possibly most useful for renaming things:
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $resized := $image.Resize "400x400" | resources.Copy "images/mynewname.jpg" }}
|
{{ with resources.Get "img/a.jpg" }}
|
||||||
<img src="{{ $resized.RelPermalink }}">
|
{{ with .Resize "300x" }}
|
||||||
|
{{ with resources.Copy "img/a-new.jpg" . }}
|
||||||
|
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
The target path must be different than the source path, as shown in the example above. See GitHub issue [#10412](https://github.com/gohugoio/hugo/issues/10412).
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
## Asset directory
|
## Asset directory
|
||||||
|
|
||||||
Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
|
Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
|
||||||
|
|||||||
Reference in New Issue
Block a user