Add js.Batch

Fixes #12626
Closes #7499
Closes #9978
Closes #12879
Closes #13113
Fixes #13116
This commit is contained in:
Bjørn Erik Pedersen
2024-12-10 16:22:08 +01:00
parent 157d86414d
commit e293e7ca6d
61 changed files with 4520 additions and 1003 deletions

View File

@@ -15,6 +15,7 @@ package resources
import (
"fmt"
"path/filepath"
"strconv"
"strings"
@@ -26,6 +27,7 @@ import (
"github.com/spf13/cast"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/common/paths"
)
var (
@@ -172,6 +174,8 @@ func assignMetadata(metadata []map[string]any, ma *metaResource) error {
name, found := meta["name"]
if found {
name := cast.ToString(name)
// Bundled resources in sub folders are relative paths with forward slashes. Make sure any renames also matches that format:
name = paths.TrimLeading(filepath.ToSlash(name))
if !nameCounterFound {
nameCounterFound = strings.Contains(name, counterPlaceHolder)
}