Skip to content

Commit 80f0595

Browse files
committed
tpl: Fix case issue in templates.Exists
Fixes #13684
1 parent b39b249 commit 80f0595

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tpl/templates/templates_integration_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,19 @@ P2.
299299
b := hugolib.Test(t, files)
300300
b.AssertFileContent("public/index.html", "P1: P1.\nP2: foo bar")
301301
}
302+
303+
func TestTemplateExistsCaseIssue13684(t *testing.T) {
304+
t.Parallel()
305+
306+
files := `
307+
-- hugo.toml --
308+
-- layouts/home.html --
309+
P1: {{ templates.Exists "_partials/MyPartial.html" }}|P1: {{ templates.Exists "_partials/mypartial.html" }}|
310+
-- layouts/_partials/MyPartial.html --
311+
MyPartial.
312+
313+
`
314+
315+
b := hugolib.Test(t, files)
316+
b.AssertFileContent("public/index.html", "P1: true|P1: true|")
317+
}

tpl/tplimpl/templatestore.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ func (s *TemplateStore) RefreshFiles(include func(fi hugofs.FileMetaInfo) bool)
712712
}
713713

714714
func (s *TemplateStore) HasTemplate(templatePath string) bool {
715+
templatePath = strings.ToLower(templatePath)
715716
templatePath = paths.AddLeadingSlash(templatePath)
716717
return s.templatesByPath.Contains(templatePath)
717718
}

0 commit comments

Comments
 (0)