Plugin sidebar order + directory layout from index.md

- PluginManager: iterate allowedPlugins in user-defined order (frontmatter order)
- content-edit.twig: plugin list with up/down arrows to set order
- Directory listing: read layout/plugins from index.md if present
- Directory default layout: full_content (no sidebar) unless index.md says otherwise
This commit is contained in:
2026-08-11 17:04:27 +02:00
parent 342112cd21
commit 03a14126ca
4 changed files with 143 additions and 33 deletions
+22 -3
View File
@@ -22,6 +22,8 @@ class HTMLBlock
$currentPage = $this->api ? $this->api->getCurrentPageTitle() : 'Onbekend';
$isHomepage = $this->api ? $this->api->isHomepage() : false;
$currentLang = $this->api ? $this->api->getCurrentLanguage() : 'nl';
$currentPath = $_GET['page'] ?? '';
$currentPath = preg_replace('/\.(md|php|html)$/', '', $currentPath);
$content = '
<p class="mb-2"><strong>Huidige pagina:</strong> ' . htmlspecialchars($currentPage) . '</p>
@@ -42,7 +44,7 @@ class HTMLBlock
</div>';
}
// Add quick navigation
// Add dynamic quick navigation
$menu = $this->api->getMenu();
if (!empty($menu)) {
$content .= '
@@ -51,8 +53,25 @@ class HTMLBlock
foreach ($menu as $item) {
if ($item['type'] === 'file') {
$url = $this->api->createUrl($item['path']);
$content .= '<li><a href="' . htmlspecialchars($url) . '" class="text-decoration-none">📄 ' . htmlspecialchars($item['title']) . '</a></li>';
$url = '/' . $currentLang . '/' . $item['path'];
$isActive = ($item['path'] === $currentPath) ? ' fw-bold' : '';
$content .= '<li><a href="' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') . '" class="text-decoration-none' . $isActive . '"><i class="bi bi-file-earmark"></i> ' . htmlspecialchars($item['title'], ENT_QUOTES, 'UTF-8') . '</a></li>';
} elseif ($item['type'] === 'folder' && !empty($item['children'])) {
$url = '/' . $currentLang . '/' . $item['path'];
$isActive = strpos($currentPath, $item['path']) === 0 ? ' fw-bold' : '';
$content .= '<li><a href="' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') . '" class="text-decoration-none' . $isActive . '"><i class="bi bi-folder"></i> ' . htmlspecialchars($item['title'], ENT_QUOTES, 'UTF-8') . '</a></li>';
// Show children if current page is in this folder
if (strpos($currentPath, $item['path']) === 0) {
$content .= '<ul class="list-unstyled ms-3 mb-1">';
foreach ($item['children'] as $child) {
if ($child['type'] === 'file') {
$childUrl = '/' . $currentLang . '/' . $child['path'];
$childActive = ($child['path'] === $currentPath) ? ' fw-bold' : '';
$content .= '<li><a href="' . htmlspecialchars($childUrl, ENT_QUOTES, 'UTF-8') . '" class="text-decoration-none' . $childActive . '"><i class="bi bi-file-earmark"></i> ' . htmlspecialchars($child['title'], ENT_QUOTES, 'UTF-8') . '</a></li>';
}
}
$content .= '</ul>';
}
}
}