From 441c8bca686b90d9f3add1c9fd628442a17ab19d Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 25 Nov 2025 20:30:11 +0100 Subject: [PATCH] Add hide_list metadata option to directories Add support for hide_list metadata option that allows directories to be displayed as pages instead of lists when they contain subfolders --- app/router.php | 8 ++++++++ docs/reference/metadata.md | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/router.php b/app/router.php index 6047183..ea17ebc 100644 --- a/app/router.php +++ b/app/router.php @@ -63,6 +63,14 @@ switch ($parsedPath['type']) { // Load metadata for this directory $metadata = loadMetadata($dir); + + // Check if hide_list is enabled - if so, treat as page + if (isset($metadata['hide_list']) && $metadata['hide_list']) { + if (!empty($contentFiles)) { + renderMultipleFiles($ctx, $contentFiles, $dir); + } + break; + } // Select list template based on metadata page_template $listTemplate = $ctx->templates->list; diff --git a/docs/reference/metadata.md b/docs/reference/metadata.md index 3bbb381..a99faa4 100644 --- a/docs/reference/metadata.md +++ b/docs/reference/metadata.md @@ -134,6 +134,20 @@ The actual folder is `about/`, but URLs become: - `/no/om-oss/` (Norwegian) - `/fr/a-propos/` (French) +### hide_list + +**Type**: Boolean +**Used in**: Directories with subdirectories +**Purpose**: Hide list of subfolders and show only page content + +```ini +hide_list = true +``` + +When enabled, directories with subfolders display as regular pages instead of showing a list view. Useful when you need subfolders for organization but want to present a single page to visitors. + +Accepted values: `true`, `false`, `1`, `0`, `yes`, `no`, `on`, `off` + ### redirect **Type**: URL string @@ -186,6 +200,7 @@ last_updated = "2025-11-02" ; Display options hide_date = true hide_author = false +hide_list = true show_toc = true ; External references