Is it possible to get template filename from template?

For learning and debug purposes I use following code in each template:

{{ if .Site.Params.debug }}
    {{ printf "<!-- Template: taxonomy/list.html -->" | safeHTML }}
{{ end}}

Is it possible to achieve same result by reusable code without filename hardcoding? Something like

{{ if .Site.Params.debug }}
    {{ printf "<!-- Template: %s -->" .TemplateRelPermalink | safeHTML }}
{{ end}}

Is it possible to achieve same result by reusable code without filename hardcoding?

Not currently.

1 Like