From b26c56ac2d3d5215cb350f57c24dcdf6ed955678 Mon Sep 17 00:00:00 2001 From: Nano Date: Sun, 3 May 2026 06:31:24 -0400 Subject: [PATCH] Fix header.asp: move nav active-state logic out of function into simple vars VBScript errors on Function defs mixed with executable code in same block. Co-Authored-By: Claude Sonnet 4.6 --- app/views/shared/header.asp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/app/views/shared/header.asp b/app/views/shared/header.asp index 22226d6..ddf539b 100644 --- a/app/views/shared/header.asp +++ b/app/views/shared/header.asp @@ -13,20 +13,24 @@ If IsObject(CurrentController) Then End If On Error GoTo 0 End If - If Len(pageTitle) = 0 Then pageTitle = "BrainOrdure" -Dim currentPath -currentPath = LCase(Request.ServerVariables("HTTP_X_ORIGINAL_URL")) -If InStr(currentPath, "?") > 0 Then currentPath = Left(currentPath, InStr(currentPath, "?") - 1) +Dim hdr_path +hdr_path = LCase(Request.ServerVariables("HTTP_X_ORIGINAL_URL")) +If InStr(hdr_path, "?") > 0 Then hdr_path = Left(hdr_path, InStr(hdr_path, "?") - 1) -Function NavClass(ByVal prefix) - If Left(currentPath, Len(prefix)) = prefix Then - NavClass = "nav-link active" - Else - NavClass = "nav-link" - End If -End Function +Dim hdr_navHome, hdr_navPosts, hdr_navCats +hdr_navHome = "nav-link" +hdr_navPosts = "nav-link" +hdr_navCats = "nav-link" + +If hdr_path = "/" Or hdr_path = "" Or Left(hdr_path, 5) = "/home" Then + hdr_navHome = "nav-link active" +ElseIf Left(hdr_path, 6) = "/posts" Then + hdr_navPosts = "nav-link active" +ElseIf Left(hdr_path, 11) = "/categories" Then + hdr_navCats = "nav-link active" +End If %> @@ -52,13 +56,13 @@ End Function