mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +02:00
tpl: Add templates.Current
This commit also * Unexport all internal state in TemplateInfo. * Make the dispatcher keys used for passing context.Context into uint8 from string to save memory allocations. Co-authored-by: Joe Mooring <joe@mooring.com> Updates #13571
This commit is contained in:
@@ -157,8 +157,7 @@ func (ns *Namespace) include(ctx context.Context, name string, dataList ...any)
|
||||
if len(dataList) > 0 {
|
||||
data = dataList[0]
|
||||
}
|
||||
name, desc := ns.deps.TemplateStore.TemplateDescriptorFromPath(name)
|
||||
v := ns.deps.TemplateStore.LookupPartial(name, desc)
|
||||
v := ns.deps.TemplateStore.LookupPartial(name)
|
||||
if v == nil {
|
||||
return includeResult{err: fmt.Errorf("partial %q not found", name)}
|
||||
}
|
||||
@@ -199,7 +198,7 @@ func (ns *Namespace) include(ctx context.Context, name string, dataList ...any)
|
||||
}
|
||||
|
||||
return includeResult{
|
||||
name: templ.Template.Name(),
|
||||
name: templ.Name(),
|
||||
result: result,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user