Display template path of current page in dev mode (#18717)
* Display template path of current page in dev mode * improve code * Update templates/base/footer_content.tmpl Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
c86ecaebae
commit
e0688995ef
2 changed files with 5 additions and 2 deletions
|
@ -197,7 +197,10 @@ func (ctx *Context) RedirectToFirst(location ...string) {
|
|||
func (ctx *Context) HTML(status int, name base.TplName) {
|
||||
log.Debug("Template: %s", name)
|
||||
tmplStartTime := time.Now()
|
||||
ctx.Data["TmplLoadTimes"] = func() string {
|
||||
if !setting.IsProd {
|
||||
ctx.Data["TemplateName"] = name
|
||||
}
|
||||
ctx.Data["TemplateLoadTimes"] = func() string {
|
||||
return strconv.FormatInt(time.Since(tmplStartTime).Nanoseconds()/1e6, 10) + "ms"
|
||||
}
|
||||
if err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue