Add multi-file page support and improve documentation

Update README to explain multi-file page functionality Add example
content files demonstrating the feature Improve folder type detection
logic Implement new routing for page-type folders Add support for mixed
content types in single pages Update navigation and metadata handling
for multi-file pages Remove legacy frontpage.php in favor of multi-file
approach Improve file-based routing documentation Add examples of
different content types working together Update router to handle
multi-file content rendering Implement proper sorting of content files
Add best practices for multi-file content organization
This commit is contained in:
Ruben 2025-11-01 18:20:23 +01:00
parent f2c18659dc
commit b507a0c676
20 changed files with 458 additions and 240 deletions

View file

@ -0,0 +1,14 @@
# Multi-File Content Pages
One of FolderWeb's most powerful features is the ability to compose a single page from multiple content files. This gives you flexibility in how you organize and author your content.
## How It Works
When a folder contains **no subdirectories**, FolderWeb treats it as a **page-type folder**. All `.md`, `.html`, and `.php` files in that folder are rendered in **alphanumerical order**.
This means you can:
- Break long content into manageable sections
- Mix file formats freely (Markdown, HTML, PHP)
- Reorder sections by renaming files
- Include dynamic PHP content alongside static content

View file

@ -0,0 +1,24 @@
## File Naming Examples
Here are some example naming patterns:
```
/my-page/
00-introduction.md
01-getting-started.md
02-advanced-topics.html
03-conclusion.php
```
Files render in this order:
1. `00-introduction.md`
2. `01-getting-started.md`
3. `02-advanced-topics.html`
4. `03-conclusion.php`
## Folder Types
FolderWeb automatically determines folder type:
- **Page-type folder**: No subdirectories → Renders all content files as a single page
- **Article-type folder**: Has subdirectories → Shows list view with links to subdirectories

View file

@ -0,0 +1,15 @@
<article>
<h2>Use Cases</h2>
<h3>Long Documentation</h3>
<p>Break lengthy documentation into logical sections. Each section gets its own file, making editing and maintenance easier.</p>
<h3>Mixed Content Types</h3>
<p>Use Markdown for simple text, HTML for complex layouts, and PHP for dynamic content—all on the same page.</p>
<h3>Collaborative Editing</h3>
<p>Multiple authors can work on different sections simultaneously without merge conflicts.</p>
<h3>Progressive Enhancement</h3>
<p>Start with simple Markdown files. Later, enhance specific sections with HTML or PHP without restructuring.</p>
</article>

View file

@ -0,0 +1,16 @@
<article>
<h2>Dynamic Content Example</h2>
<p>This section is a PHP file that generates dynamic content. Here are some examples:</p>
<div style="background: #f0f9ff; border: 1px solid #0284c7; padding: 1.5rem; border-radius: 8px; margin: 1.5rem 0;">
<h3>Server Information</h3>
<ul style="list-style: none; padding: 0;">
<li><strong>Current Time:</strong> <?= date('H:i:s') ?></li>
<li><strong>Today's Date:</strong> <?= date('l, F j, Y') ?></li>
<li><strong>PHP Version:</strong> <?= PHP_VERSION ?></li>
</ul>
</div>
<p>PHP files can access all the same variables and functions available throughout FolderWeb, making it easy to create dynamic, data-driven content.</p>
</article>

View file

@ -0,0 +1,23 @@
## Best Practices
### Use Descriptive Prefixes
Number your files with two-digit prefixes (`00-`, `01-`, `02-`) to maintain clear ordering:
- Allows up to 100 sections before needing three digits
- Keeps files sorted in file managers
- Makes reordering easy (just rename)
### Choose the Right Format
- **Markdown (`.md`)** - For most content. Simple, clean, readable.
- **HTML (`.html`)** - For complex layouts or embedded media.
- **PHP (`.php`)** - For dynamic content, calculations, or data display.
### Keep It Simple
Don't overcomplicate. If your page works well as a single file, keep it that way. Use multiple files when they genuinely make maintenance easier.
---
**This article itself demonstrates the multi-file approach.** View the source folder to see how it's structured!

View file

@ -0,0 +1,3 @@
title = "Multi-File Content Pages"
date = "2025-11-02"
summary = "Learn how to create pages from multiple content files in any format"