mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Merge commit 'a024bc7d76fcc5e49e8210f9b0896db9ef21861a'
This commit is contained in:
@@ -17,6 +17,7 @@ The `Data` method on a resource returned by the [`resources.GetRemote`] function
|
||||
|
||||
```go-html-template
|
||||
{{ $url := "https://example.org/images/a.jpg" }}
|
||||
{{ $opts := dict "responseHeaders" (slice "Server") }}
|
||||
{{ with try (resources.GetRemote $url) }}
|
||||
{{ with .Err }}
|
||||
{{ errorf "%s" . }}
|
||||
@@ -24,6 +25,7 @@ The `Data` method on a resource returned by the [`resources.GetRemote`] function
|
||||
{{ with .Data }}
|
||||
{{ .ContentLength }} → 42764
|
||||
{{ .ContentType }} → image/jpeg
|
||||
{{ .Headers }} → map[Server:[Netlify]]
|
||||
{{ .Status }} → 200 OK
|
||||
{{ .StatusCode }} → 200
|
||||
{{ .TransferEncoding }} → []
|
||||
@@ -34,19 +36,30 @@ The `Data` method on a resource returned by the [`resources.GetRemote`] function
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
ContentLength
|
||||
: (`int`) The content length in bytes.
|
||||
###### ContentLength
|
||||
|
||||
ContentType
|
||||
: (`string`) The content type.
|
||||
(`int`) The content length in bytes.
|
||||
|
||||
Status
|
||||
: (`string`) The HTTP status text.
|
||||
###### ContentType
|
||||
|
||||
StatusCode
|
||||
: (`int`) The HTTP status code.
|
||||
(`string`) The content type.
|
||||
|
||||
TransferEncoding
|
||||
: (`string`) The transfer encoding.
|
||||
###### Headers
|
||||
|
||||
(`map[string][]string`) A map of response headers matching those requested in the [`responseHeaders`] option passed to the `resources.GetRemote` function. The header name matching is case-insensitive. In most cases there will be one value per header key.
|
||||
|
||||
[`responseHeaders`]: /functions/resources/getremote/#responseheaders
|
||||
|
||||
###### Status
|
||||
|
||||
(`string`) The HTTP status text.
|
||||
|
||||
###### StatusCode
|
||||
|
||||
(`int`) The HTTP status code.
|
||||
|
||||
###### TransferEncoding
|
||||
|
||||
(`string`) The transfer encoding.
|
||||
|
||||
[`resources.GetRemote`]: /functions/resources/getremote/
|
||||
|
Reference in New Issue
Block a user