From 721e9ef66f6ac30ba9c8d1b3b464b7c2181bcb60 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Tue, 7 Jun 2016 20:29:12 +0300 Subject: [PATCH] add {{ urlpath }} - returns the path without scheme & domain , near to the {{ url }} --- iris.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iris.go b/iris.go index 8cc0cc1f..c43d52f2 100644 --- a/iris.go +++ b/iris.go @@ -124,6 +124,10 @@ func (s *Iris) initTemplates() { } }) + template.RegisterSharedFunc("urlpath", func(routeName string, args ...interface{}) string { + return s.RouteByName(routeName).ParsePath(args...) + }) + s.templates = template.New(s.config.Render.Template) }