folderweb/app/default/content/examples/file-based-routing/index.md
Ruben 0e19040473 Create a simple hero section with title, subtitle, and call-to-action
button Add a features section with icons and descriptions Include a
stats section with live data Add a responsive design with modern CSS
features
2025-11-27 21:31:47 +01:00

52 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# File-Based Routing
FolderWeb's routing is beautifully simple: **your folder structure is your URL structure**. No configuration files, no route definitions, no magic strings.
## How It Works
When you visit a URL, FolderWeb looks for matching folders and files:
```
/content/
├── index.md → /
├── about/
│ └── index.md → /about/
└── blog/
├── 2024-11-01-post/
│ └── index.md → /blog/post/
└── index.md → /blog/
```
## Automatic Features
**Folder names become URLs** Create a folder called `projects` and it's instantly available at `/projects/`
**Date prefixes are stripped** `2024-11-01-my-post` becomes `/my-post/` in the URL
**Custom slugs via metadata** Override the default URL with `slug = "custom-url"` in `metadata.ini`
**Trailing slashes** Directories always redirect to include trailing slashes for consistency
## Example
This very page demonstrates file-based routing! The path is:
```
app/default/content/examples/file-based-routing/index.md
```
Which renders at:
```
/examples/file-based-routing/
```
No routes to define. No configuration to update. Just files and folders.
## Benefits
- **Intuitive** If you can navigate folders, you understand the routing
- **Refactor-friendly** Moving content means moving folders
- **No broken links** URLs match the filesystem
- **Fast** No route matching overhead, direct file lookup
- **Predictable** What you see is what you get