diff --git a/build.ps1 b/build.ps1 index 53efe64..5d4d79c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -147,6 +147,9 @@ Get-ChildItem -Path wiki -Filter *.html -Recurse | Where-Object { $_.Name -ne 'i # Calculate relative path from wiki/ to the current HTML file $relPath = $htmlFile.Substring($wikiFull.Length).TrimStart('\','/') + # Normalize path separators to forward slashes for URLs + $relPath = $relPath -replace '\\', '/' + $filename = [System.IO.Path]::GetFileNameWithoutExtension($htmlFile) # Skip if the file is already at the root of wiki/ @@ -167,9 +170,8 @@ Get-ChildItem -Path wiki -Filter *.html -Recurse | Where-Object { $_.Name -ne 'i # Relative URL: go up one level then down to the original file $relativeUrl = '../' + $relPath - # URL-encode spaces and special chars - Add-Type -AssemblyName System.Web - $encodedUrl = [System.Web.HttpUtility]::UrlEncode($relativeUrl) + # URL-encode spaces but keep forward slashes + $encodedUrl = $relativeUrl -replace ' ', '%20' $redirectHtml = @" diff --git a/generate_nav.py b/generate_nav.py index 6c820d0..fc5fcea 100644 --- a/generate_nav.py +++ b/generate_nav.py @@ -137,7 +137,7 @@ def scan_folder(folder: Path, base_path: Path) -> list: for md_file in md_files: title = get_file_title(md_file) rel_path = md_file.relative_to(base_path) - nav_items.append((title, str(rel_path))) + nav_items.append((title, str(rel_path).replace('\\', '/'))) # Process subfolders recursively for subfolder in subfolders: