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:
parent
f2c18659dc
commit
b507a0c676
20 changed files with 458 additions and 240 deletions
6
app/default/content/00-welcome.php
Normal file
6
app/default/content/00-welcome.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<header style="text-align: center; padding: 4rem 0 2rem;">
|
||||
<h1 style="font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 1rem;">Welcome to FolderWeb</h1>
|
||||
<p style="font-size: clamp(1.125rem, 2vw, 1.5rem); color: oklch(0.5 0 0); max-width: 60ch; margin: 0 auto;">
|
||||
A minimalist PHP framework that turns folders into websites. No JavaScript, no build tools, just simple files.
|
||||
</p>
|
||||
</header>
|
||||
7
app/default/content/00a-getting-started.md
Normal file
7
app/default/content/00a-getting-started.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## Getting Started
|
||||
|
||||
This is demo content to help you understand how FolderWeb works. To replace it with your own content:
|
||||
|
||||
1. Create a `/content` folder in your project root
|
||||
2. Add your content files (`.md`, `.html`, or `.php`)
|
||||
3. This demo will automatically disappear
|
||||
15
app/default/content/01-core-concepts.md
Normal file
15
app/default/content/01-core-concepts.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## Core Concepts
|
||||
|
||||
### File-Based Routing
|
||||
|
||||
Drop a file in a folder and it's instantly accessible at a URL matching that path. Your folder structure becomes your URL structure.
|
||||
|
||||
### Multiple Content Types
|
||||
|
||||
- **Markdown** - Write in `.md` files, automatically converted to HTML
|
||||
- **HTML** - Pure HTML files for complete control
|
||||
- **PHP** - Dynamic content when you need it
|
||||
|
||||
### Multi-File Pages
|
||||
|
||||
Any folder without subfolders renders all content files (`.md`, `.html`, `.php`) in alphanumerical order. Mix formats freely!
|
||||
13
app/default/content/02-features.html
Normal file
13
app/default/content/02-features.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<article>
|
||||
<h2>Smart Features</h2>
|
||||
|
||||
<ul>
|
||||
<li><strong>Metadata</strong> - Use <code>metadata.ini</code> files for titles, dates, summaries</li>
|
||||
<li><strong>Date extraction</strong> - Folder names like <code>2025-11-01-title</code> automatically show dates</li>
|
||||
<li><strong>Cover images</strong> - Add <code>cover.jpg</code> for list view thumbnails</li>
|
||||
<li><strong>Templates</strong> - Custom templates in <code>/custom/templates/</code> override defaults</li>
|
||||
</ul>
|
||||
|
||||
<h2>Explore the Demo</h2>
|
||||
<p>Check out the <a href="/articles/">Articles</a> and <a href="/about/">About</a> pages to see different content types in action.</p>
|
||||
</article>
|
||||
11
app/default/content/03-this-page-demo.md
Normal file
11
app/default/content/03-this-page-demo.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
## About This Frontpage
|
||||
|
||||
**This frontpage demonstrates the multi-file approach!** It's composed of:
|
||||
|
||||
1. `00-welcome.php` - Hero header (PHP/HTML)
|
||||
2. `00a-getting-started.md` - Getting started guide (Markdown)
|
||||
3. `01-core-concepts.md` - Core concepts (Markdown)
|
||||
4. `02-features.html` - Features and links (HTML)
|
||||
5. `03-this-page-demo.md` - This explanation (Markdown)
|
||||
|
||||
All files in the root `/content` folder are rendered together, just like pages in subfolders. Name your files anything you want—they'll render in alphanumerical order.
|
||||
15
app/default/content/about/00-introduction.md
Normal file
15
app/default/content/about/00-introduction.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# About FolderWeb
|
||||
|
||||
FolderWeb is a minimalist PHP framework designed for simplicity, longevity, and maintainability. It's built on a simple philosophy: **just enough, nothing more**.
|
||||
|
||||
## Philosophy
|
||||
|
||||
Modern web development has become unnecessarily complex. Build tools, package managers, JavaScript frameworks that change every few months—it's exhausting and unsustainable.
|
||||
|
||||
FolderWeb is different. It's built to:
|
||||
|
||||
- **Work for decades** without requiring constant updates
|
||||
- **Be understandable** by reading a few hundred lines of code
|
||||
- **Stay maintainable** without specialized knowledge
|
||||
- **Load fast** with no JavaScript overhead
|
||||
- **Just work** without configuration or setup
|
||||
15
app/default/content/about/01-design-principles.html
Normal file
15
app/default/content/about/01-design-principles.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<article>
|
||||
<h2>Design Principles</h2>
|
||||
|
||||
<h3>Minimalism</h3>
|
||||
<p>Use only what is strictly necessary. No frameworks, no build tools, no package managers for frontend code. Every line of code must justify its existence.</p>
|
||||
|
||||
<h3>File-Based Everything</h3>
|
||||
<p>Your folder structure is your URL structure. Drop a file in a folder and it's instantly accessible. No routes to configure, no databases to set up.</p>
|
||||
|
||||
<h3>Override, Never Modify</h3>
|
||||
<p>Custom templates and styles go in <code>/custom/</code> and automatically override defaults. The core files in <code>/app/default/</code> remain untouched and updateable.</p>
|
||||
|
||||
<h3>Modern Standards</h3>
|
||||
<p>Use modern PHP 8.3+ features and modern CSS capabilities. Avoid JavaScript entirely—it's not needed for content-focused sites.</p>
|
||||
</article>
|
||||
21
app/default/content/about/02-technology-stack.php
Normal file
21
app/default/content/about/02-technology-stack.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<article>
|
||||
<h2>Technology Stack</h2>
|
||||
|
||||
<h3>Backend</h3>
|
||||
<ul>
|
||||
<li><strong>PHP 8.3+</strong> - Modern PHP with type hints, arrow functions, match expressions</li>
|
||||
<li><strong>Apache</strong> - With mod_rewrite for clean URLs</li>
|
||||
<li><strong>Parsedown</strong> - Simple, reliable Markdown parser</li>
|
||||
</ul>
|
||||
|
||||
<h3>Frontend</h3>
|
||||
<ul>
|
||||
<li><strong>HTML5</strong> - Semantic markup following best practices</li>
|
||||
<li><strong>CSS3</strong> - Modern features like Grid, clamp(), OKLCH colors, CSS nesting</li>
|
||||
<li><strong>No JavaScript</strong> - By design, for faster loads and simpler maintenance</li>
|
||||
</ul>
|
||||
|
||||
<aside style="background: #f5f5f5; padding: 1rem; border-left: 4px solid #333; margin: 2rem 0;">
|
||||
<p><strong>Note:</strong> This section demonstrates using PHP for dynamic content. The current date is: <strong><?= date('F j, Y') ?></strong></p>
|
||||
</aside>
|
||||
</article>
|
||||
19
app/default/content/about/03-what-it-is-not.md
Normal file
19
app/default/content/about/03-what-it-is-not.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
## What It's Not
|
||||
|
||||
FolderWeb is **not**:
|
||||
|
||||
- A CMS with an admin panel
|
||||
- A single-page application framework
|
||||
- A solution for complex web applications
|
||||
- Trying to scale to millions of users
|
||||
- Following current trends and fads
|
||||
|
||||
## What It Is
|
||||
|
||||
FolderWeb **is**:
|
||||
|
||||
- A simple way to publish content
|
||||
- A foundation that will work for decades
|
||||
- A teaching tool for web fundamentals
|
||||
- A protest against unnecessary complexity
|
||||
- Perfect for documentation, blogs, portfolios, small business sites
|
||||
21
app/default/content/about/04-get-started.md
Normal file
21
app/default/content/about/04-get-started.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
## Get Started
|
||||
|
||||
Ready to build something simple and lasting?
|
||||
|
||||
1. Create a `/content` folder
|
||||
2. Add your first `.md` file
|
||||
3. That's it—you're publishing
|
||||
|
||||
No build step. No npm install. No configuration files. Just content.
|
||||
|
||||
---
|
||||
|
||||
**This page demonstrates FolderWeb's multi-file approach.** Notice how this page is built from multiple files that render in alphanumerical order:
|
||||
|
||||
- `00-introduction.md` - Markdown content
|
||||
- `01-design-principles.html` - Static HTML
|
||||
- `02-technology-stack.php` - Dynamic PHP (shows current date)
|
||||
- `03-what-it-is-not.md` - More Markdown
|
||||
- `04-get-started.md` - This section
|
||||
|
||||
Mix file types freely. They all render together seamlessly!
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
# About FolderWeb
|
||||
|
||||
FolderWeb is a minimalist PHP framework designed for simplicity, longevity, and maintainability. It's built on a simple philosophy: **just enough, nothing more**.
|
||||
|
||||
## Philosophy
|
||||
|
||||
Modern web development has become unnecessarily complex. Build tools, package managers, JavaScript frameworks that change every few months—it's exhausting and unsustainable.
|
||||
|
||||
FolderWeb is different. It's built to:
|
||||
|
||||
- **Work for decades** without requiring constant updates
|
||||
- **Be understandable** by reading a few hundred lines of code
|
||||
- **Stay maintainable** without specialized knowledge
|
||||
- **Load fast** with no JavaScript overhead
|
||||
- **Just work** without configuration or setup
|
||||
|
||||
## Design Principles
|
||||
|
||||
### Minimalism
|
||||
Use only what is strictly necessary. No frameworks, no build tools, no package managers for frontend code. Every line of code must justify its existence.
|
||||
|
||||
### File-Based Everything
|
||||
Your folder structure is your URL structure. Drop a file in a folder and it's instantly accessible. No routes to configure, no databases to set up.
|
||||
|
||||
### Override, Never Modify
|
||||
Custom templates and styles go in `/custom/` and automatically override defaults. The core files in `/app/default/` remain untouched and updateable.
|
||||
|
||||
### Modern Standards
|
||||
Use modern PHP 8.3+ features and modern CSS capabilities. Avoid JavaScript entirely—it's not needed for content-focused sites.
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Backend
|
||||
- **PHP 8.3+** - Modern PHP with type hints, arrow functions, match expressions
|
||||
- **Apache** - With mod_rewrite for clean URLs
|
||||
- **Parsedown** - Simple, reliable Markdown parser
|
||||
|
||||
### Frontend
|
||||
- **HTML5** - Semantic markup following best practices
|
||||
- **CSS3** - Modern features like Grid, clamp(), OKLCH colors, CSS nesting
|
||||
- **No JavaScript** - By design, for faster loads and simpler maintenance
|
||||
|
||||
## What It's Not
|
||||
|
||||
FolderWeb is **not**:
|
||||
|
||||
- A CMS with an admin panel
|
||||
- A single-page application framework
|
||||
- A solution for complex web applications
|
||||
- Trying to scale to millions of users
|
||||
- Following current trends and fads
|
||||
|
||||
## What It Is
|
||||
|
||||
FolderWeb **is**:
|
||||
|
||||
- A simple way to publish content
|
||||
- A foundation that will work for decades
|
||||
- A teaching tool for web fundamentals
|
||||
- A protest against unnecessary complexity
|
||||
- Perfect for documentation, blogs, portfolios, small business sites
|
||||
|
||||
## Use Cases
|
||||
|
||||
FolderWeb excels at:
|
||||
|
||||
- **Documentation sites** - Clear structure, easy to navigate
|
||||
- **Personal blogs** - Simple publishing workflow
|
||||
- **Portfolio sites** - Showcase your work without bloat
|
||||
- **Small business sites** - Professional presence without complexity
|
||||
- **Project pages** - Quick site for your open source project
|
||||
|
||||
## Who Created This?
|
||||
|
||||
FolderWeb emerged from frustration with modern web development complexity. It's built for developers who appreciate simplicity and maintainability over features and frameworks.
|
||||
|
||||
## License
|
||||
|
||||
FolderWeb is open source. Check the repository for license details.
|
||||
|
||||
## Get Started
|
||||
|
||||
Ready to build something simple and lasting?
|
||||
|
||||
1. Create a `/content` folder
|
||||
2. Add your first `.md` file
|
||||
3. That's it—you're publishing
|
||||
|
||||
No build step. No npm install. No configuration files. Just content.
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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!
|
||||
|
|
@ -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"
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<article>
|
||||
<header style="text-align: center; padding: 4rem 0 2rem;">
|
||||
<h1 style="font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 1rem;">Welcome to FolderWeb</h1>
|
||||
<p style="font-size: clamp(1.125rem, 2vw, 1.5rem); color: oklch(0.5 0 0); max-width: 60ch; margin: 0 auto;">
|
||||
A minimalist PHP framework that turns folders into websites. No JavaScript, no build tools, just simple files.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<section style="max-width: 70ch; margin: 3rem auto;">
|
||||
<h2>Getting Started</h2>
|
||||
<p>
|
||||
This is demo content to help you understand how FolderWeb works. To replace it with your own content:
|
||||
</p>
|
||||
<ol>
|
||||
<li>Create a <code>/content</code> folder in your project root</li>
|
||||
<li>Add your content files (<code>.md</code>, <code>.html</code>, or <code>.php</code>)</li>
|
||||
<li>This demo will automatically disappear</li>
|
||||
</ol>
|
||||
|
||||
<h2>Core Concepts</h2>
|
||||
|
||||
<h3>File-Based Routing</h3>
|
||||
<p>
|
||||
Drop a file in a folder and it's instantly accessible at a URL matching that path.
|
||||
Your folder structure becomes your URL structure.
|
||||
</p>
|
||||
|
||||
<h3>Multiple Content Types</h3>
|
||||
<ul>
|
||||
<li><strong>Markdown</strong> - Write in <code>.md</code> files, automatically converted to HTML</li>
|
||||
<li><strong>HTML</strong> - Pure HTML files for complete control</li>
|
||||
<li><strong>PHP</strong> - Dynamic content when you need it</li>
|
||||
</ul>
|
||||
|
||||
<h3>Smart Features</h3>
|
||||
<ul>
|
||||
<li><strong>Metadata</strong> - Use <code>metadata.ini</code> files for titles, dates, summaries</li>
|
||||
<li><strong>Date extraction</strong> - Folder names like <code>2025-11-01-title</code> automatically show dates</li>
|
||||
<li><strong>Cover images</strong> - Add <code>cover.jpg</code> for list view thumbnails</li>
|
||||
<li><strong>Templates</strong> - Custom templates in <code>/custom/templates/</code> override defaults</li>
|
||||
</ul>
|
||||
|
||||
<h2>Explore the Demo</h2>
|
||||
<p>
|
||||
Check out the <a href="/articles/">Articles</a> and <a href="/about/">About</a> pages to see different content types in action.
|
||||
</p>
|
||||
</section>
|
||||
</article>
|
||||
Loading…
Add table
Add a link
Reference in a new issue