summaryrefslogtreecommitdiffstats
path: root/resources/page/permalinks.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-09-22 15:15:16 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-09-24 11:54:29 +0200
commitef0e7149d63c64269b852cf68a2af67b94b8eec3 (patch)
tree7182a4d3e396d231a3c62c4ca76055eb3ba3a845 /resources/page/permalinks.go
parentc32094ace113412abea354b7119d154168097287 (diff)
Add $image.Process
Which supports all the existing actions: resize, crop, fit, fill. But it also allows plain format conversions: ``` {{ $img = $img.Process "webp" }} ``` Which will be a simple re-encoding of the source image. Fixes #11483
Diffstat (limited to 'resources/page/permalinks.go')
-rw-r--r--resources/page/permalinks.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/resources/page/permalinks.go b/resources/page/permalinks.go
index ee9608dac..4577f5240 100644
--- a/resources/page/permalinks.go
+++ b/resources/page/permalinks.go
@@ -14,6 +14,7 @@
package page
import (
+ "errors"
"fmt"
"os"
"path"
@@ -23,8 +24,7 @@ import (
"strings"
"time"
- "errors"
-
+ "github.com/gohugoio/hugo/common/hstrings"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/resources/kinds"
@@ -396,7 +396,6 @@ func (l PermalinkExpander) toSliceFunc(cut string) func(s []string) []string {
}
return s[n1:n2]
}
-
}
var permalinksKindsSupport = []string{kinds.KindPage, kinds.KindSection, kinds.KindTaxonomy, kinds.KindTerm}
@@ -425,7 +424,7 @@ func DecodePermalinksConfig(m map[string]any) (map[string]map[string]string, err
// [permalinks.key]
// xyz = ???
- if helpers.InStringArray(permalinksKindsSupport, k) {
+ if hstrings.InSlice(permalinksKindsSupport, k) {
// TODO: warn if we overwrite an already set value
for k2, v2 := range v {
switch v2 := v2.(type) {