tpl: Make {{ template "partials/foo.html" . }} work in older setups

Fixes #13599
This commit is contained in:
Bjørn Erik Pedersen
2025-04-14 11:05:07 +02:00
parent 915ba3f7f0
commit 1e0287f472
5 changed files with 76 additions and 1 deletions

View File

@@ -99,7 +99,14 @@ func (t *templateNamespace) parseTemplate(ti *TemplInfo) error {
return err
}
}
}
// Issue #13599.
if ti.category == CategoryPartial && ti.Fi != nil && ti.Fi.Meta().PathInfo.Section() == "partials" {
aliasName := strings.TrimPrefix(name, "_")
if _, err := prototype.AddParseTree(aliasName, templ.(*htmltemplate.Template).Tree); err != nil {
return err
}
}
}