b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", "P1: P1.\nP2: foo bar")
}
+
+func TestTemplateExistsCaseIssue13684(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+-- layouts/home.html --
+P1: {{ templates.Exists "_partials/MyPartial.html" }}|P1: {{ templates.Exists "_partials/mypartial.html" }}|
+-- layouts/_partials/MyPartial.html --
+MyPartial.
+
+`
+
+ b := hugolib.Test(t, files)
+ b.AssertFileContent("public/index.html", "P1: true|P1: true|")
+}
}
func (s *TemplateStore) HasTemplate(templatePath string) bool {
+ templatePath = strings.ToLower(templatePath)
templatePath = paths.AddLeadingSlash(templatePath)
return s.templatesByPath.Contains(templatePath)
}