diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-02-20 16:08:18 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-02-20 16:47:07 +0100 |
commit | 48eec2a4e63cb0b542858f3b133eba19aa23978c (patch) | |
tree | 5b14e75413397dbb9e78ab6ac6e6ebf8862ae763 /hugolib | |
parent | a118cb4138bc903566ade49a7789d91657898a21 (diff) |
Fall back to original name in Resources.GetMatch/Match
Same as we do in .Get.
Fixes #12076
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/pagebundler_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go index 9f5255c74..e9686706d 100644 --- a/hugolib/pagebundler_test.go +++ b/hugolib/pagebundler_test.go @@ -876,3 +876,20 @@ RegularPages: {{ range .RegularPages }}{{ .RelPermalink }}|File LogicalName: {{ "List: |/mysection|File LogicalName: _index.md|/mysection/|section|Resources: sectiondata.json: Secion data JSON.|sectiondata.txt: Section data TXT.|$", "RegularPages: /mysection/foo/p2/|File LogicalName: p2.md|/mysection/mybundle/|File LogicalName: index.md|/mysection/p2/|File LogicalName: p2.md|$") } + +func TestBundleResourcesGetMatchOriginalName(t *testing.T) { + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +-- content/mybundle/index.md -- +-- content/mybundle/f1.en.txt -- +F1. +-- layouts/_default/single.html -- +GetMatch: {{ with .Resources.GetMatch "f1.en.*" }}{{ .Name }}: {{ .Content }}|{{ end }} +Match: {{ range .Resources.Match "f1.en.*" }}{{ .Name }}: {{ .Content }}|{{ end }} +` + + b := Test(t, files) + + b.AssertFileContent("public/mybundle/index.html", "GetMatch: f1.txt: F1.|", "Match: f1.txt: F1.|") +} |