summaryrefslogtreecommitdiff
path: root/nexus/tags/active.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexus/tags/active.go')
-rw-r--r--nexus/tags/active.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/nexus/tags/active.go b/nexus/tags/active.go
new file mode 100644
index 0000000..c762222
--- /dev/null
+++ b/nexus/tags/active.go
@@ -0,0 +1,20 @@
+package tags
+
+import (
+ "nexus/utils/urls"
+
+ "github.com/flosch/pongo2/v6"
+)
+
+func active(value *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
+ routeName := value.String()
+
+ routePath, exists := urls.GetFullPath(routeName)
+ if !exists {
+ return pongo2.AsValue(false), nil
+ }
+
+ requestPath := param.String()
+
+ return pongo2.AsValue(requestPath == routePath), nil
+}