mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'a024bc7d76fcc5e49e8210f9b0896db9ef21861a'
This commit is contained in:
@@ -20,11 +20,11 @@ The `Resources.Colors` method returns a slice of the most dominant colors in an
|
||||
Each color is an object with the following methods:
|
||||
|
||||
ColorHex
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`string`) Returns the [hexadecimal color] value, prefixed with a hash sign.
|
||||
|
||||
Luminance
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`float64`) Returns the [relative luminance] of the color in the sRGB colorspace in the range [0, 1]. A value of `0` represents the darkest black, while a value of `1` represents the lightest white.
|
||||
|
||||
{{% note %}}
|
||||
|
@@ -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/
|
||||
|
@@ -9,7 +9,7 @@ action:
|
||||
- methods/resource/Data
|
||||
returnType: resource.resourceError
|
||||
signatures: [RESOURCE.Err]
|
||||
expiryDate: 2026-01-16 # deprecated 2025-01-16
|
||||
expiryDate: 2027-01-16 # deprecated 2025-01-16 in v0.141.0
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.141.0 %}}
|
||||
|
Reference in New Issue
Block a user