From 83a5132d150e0db18653b5c90b9aff003fb02c68 Mon Sep 17 00:00:00 2001 From: Dejan Strbac Date: Thu, 16 Jan 2020 13:36:03 +0100 Subject: [PATCH] Add current path to the global context --- template.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template.go b/template.go index dfb9a97..97a356c 100644 --- a/template.go +++ b/template.go @@ -14,6 +14,8 @@ const themesDir = "themes" // GlobalRenderData contains data available in all templates. type GlobalRenderData struct { + Path string + LoggedIn bool // if logged in @@ -70,6 +72,8 @@ func NewBaseRenderData(ctx *Context) *BaseRenderData { global.Username = ctx.Session.username } + global.Path = ctx.Request().URL.String() + return &BaseRenderData{ GlobalData: global, Extra: make(map[string]interface{}),