From cc2dc3d91878b5120705af431079f2d7e3cc8c99 Mon Sep 17 00:00:00 2001 From: elektrischerwalfisch Date: Mon, 19 May 2025 21:36:16 +0200 Subject: [PATCH] add support for pages-subfolders --- config-basic.php | 5 +++-- config-multilang.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config-basic.php b/config-basic.php index cfed2d3..f73e048 100644 --- a/config-basic.php +++ b/config-basic.php @@ -10,8 +10,9 @@ // Define page language $lang = 'de'; - // Use the first URI segment if available; otherwise default to 'home' - $page = !empty($uriParts[0]) ? $uriParts[0] : 'home'; + // Join all available URL segments to also support subfolders, otherwise default to 'home' + $pagePath = implode('/', $uriParts); + $page = $pagePath !== '' ? $pagePath : 'home'; // Set content-folder $folder = __DIR__ . '/pages/'; diff --git a/config-multilang.php b/config-multilang.php index 0fc9e37..95858cb 100644 --- a/config-multilang.php +++ b/config-multilang.php @@ -28,7 +28,8 @@ // Determine the requested language and page from the URL and build the file path $lang = $uriParts[0]; // Set language based on the first URL segment - $page = $uriParts[1] ?? 'home'; // Set page based on the second URL segment, default to 'home' + $pagePath = implode('/', array_slice($uriParts, 1)); // Build page path from remaining segments after language (including subfolders) + $page = $pagePath !== '' ? $pagePath : 'home'; // default to 'home' $file = $languageFolders[$lang] . $page . '.md'; // Construct the full file path for the Markdown file // Define header and footer file paths -- 2.47.3