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
This commit is contained in:
Ruben 2025-11-25 20:30:11 +01:00
parent a205f2cbd7
commit 441c8bca68
2 changed files with 23 additions and 0 deletions

View file

@ -64,6 +64,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;
if (isset($metadata['page_template']) && !empty($metadata['page_template'])) {

View file

@ -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