mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +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:
@@ -102,3 +102,8 @@ func (ns *Namespace) DoDefer(ctx context.Context, id string, optsv any) string {
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
// Get information about the currently executing template.
|
||||
func (ns *Namespace) Current(ctx context.Context) *tpl.CurrentTemplateInfo {
|
||||
return tpl.Context.CurrentTemplate.Get(ctx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user