From 3d7f04b92b8a2f82f03f03c4b0491838fd18c287 Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 19 Mar 2020 09:50:57 +1000 Subject: [PATCH] tweak renderTemplate3 for performance --- routes/common.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/common.go b/routes/common.go index 3abb56be..e4884d01 100644 --- a/routes/common.go +++ b/routes/common.go @@ -120,7 +120,8 @@ func renderTemplate3(tmplName, hookName string, w http.ResponseWriter, r *http.R s := h.Stylesheets h.Stylesheets = nil simpleBot := h.CurrentUser.LastAgent == c.Semrush || h.CurrentUser.LastAgent == c.Ahrefs - if r.FormValue("i") != "1" && !simpleBot { + inner := r.FormValue("i") == "1" + if !inner && !simpleBot { c.PrepResources(h.CurrentUser, h, h.Theme) for _, ss := range s { h.Stylesheets = append(h.Stylesheets, ss) @@ -129,10 +130,11 @@ func renderTemplate3(tmplName, hookName string, w http.ResponseWriter, r *http.R if h.CurrentUser.Loggedin { h.AddScriptAsync("member.js") } + } else { h.CurrentUser.LastAgent = 0 } - if h.CurrentUser.Loggedin || simpleBot { + if h.CurrentUser.Loggedin || inner || simpleBot { h.MetaDesc = "" h.OGDesc = "" } else if h.MetaDesc != "" && h.OGDesc == "" {