mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
Merge commit 'd3927310d5b2404c3238f9b899db3329ea516490'
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:
|
||||
|
||||
```go-html-template
|
||||
{{ $resized := $image.Resize "400x400" | resources.Copy "images/mynewname.jpg" }}
|
||||
<img src="{{ $resized.RelPermalink }}">
|
||||
{{ with resources.Get "img/a.jpg" }}
|
||||
{{ 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 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