]> skyeroc.xyz Git - flatmark/commitdiff
add support for pages-subfolders
authorelektrischerwalfisch <mail@elektrischerwalfisch.de>
Mon, 19 May 2025 19:36:16 +0000 (21:36 +0200)
committerelektrischerwalfisch <mail@elektrischerwalfisch.de>
Mon, 19 May 2025 19:36:16 +0000 (21:36 +0200)
config-basic.php
config-multilang.php

index cfed2d38e80bd3aef74010ec4949f8ac65df2bb3..f73e0483bcd8fe30623f5ef96284c2fc4d044cc8 100644 (file)
@@ -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/';
index 0fc9e37afb51466a35e58b69864d4b205f979f70..95858cba7a1b58f1c929cd4c417a3788042570f2 100644 (file)
@@ -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