v2.6.3 (Lyra): Content multi-type handling, getAllPages() structuur, . verberg-prefix
- Content bestanden met dezelfde naam maar ander type (md/php/html) worden correct geserveerd: URL met extensie opent dat bestand, URL zonder extensie valt terug op md > php > html (resolveContentByType helper) - Admin content editor accepteert bestanden met dezelfde naam (ander type); preview-knop linkt per extensie - Frontend navigatie/directory listing/search tonen elk bestandstype apart - getAllPages() array structuur gewijzigd naar list van ['path','title','type'] met type 'md'/'php'/'html'/'folder' - Verberg-prefix logica: _ is geen verberg-prefix meer, alleen . (en -); admin toont wél alle . bestanden/mappen - ContentAPI getPage()/pageExists() respecteren expliciete extensie - Handleiding content-api.md (NL+EN) herschreven - File-tree unificatie: _file-tree.twig + _editor-styles.twig includes - Versie verhoogd naar 2.6.3
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
# Content management
|
||||
|
||||
CodePress offers two views for content management:
|
||||
CodePress uses a **tree view** (`/admin/content`) for content management: a file browser sidebar + CodeMirror editor, uniform with the plugin and theme editors. The old list/table view has been removed.
|
||||
|
||||
1. **Tree view** (`/admin/content`) — default, file browser sidebar + CodeMirror editor (uniform with plugin/theme editors)
|
||||
2. **List view** (`/admin/content-list`) — classic table with filter, upload, new folder/file per folder
|
||||
|
||||
Both work side-by-side and use the same content directory. Switch between views via the "List view"/"Tree view" buttons at the top right. The tree view offers the same functionality as the list view, but with a nested file-tree sidebar like the plugin and theme editors — for a consistent editor experience.
|
||||
|
||||
## Tree view (content)
|
||||
## Content editor
|
||||
|
||||
### File browser sidebar
|
||||
- Shows the nested file tree of `content/`
|
||||
@@ -19,6 +14,30 @@ Both work side-by-side and use the same content directory. Switch between views
|
||||
### Editable file types
|
||||
`.md` (Markdown), `.php` (PHP), `.html` (HTML) — consistent with the existing content-edit page.
|
||||
|
||||
All types support `---` frontmatter (layout, created, edited, plugins). The CMS `parseMetadata()` extracts frontmatter before processing. For PHP files, frontmatter is stripped from the output.
|
||||
|
||||
#### PHP content files
|
||||
PHP files can deliver content in two ways:
|
||||
1. **Echo** (output buffering): everything `echo`ed or outside `<?php` tags is used as content
|
||||
2. **Return** (callback style): `return '<h1>Hello</h1>';` — the returned string is used as content
|
||||
|
||||
In PHP files, the `ContentAPI` is available via `$api`:
|
||||
```php
|
||||
<?php
|
||||
$menu = $api->getMenu();
|
||||
$pages = $api->getAllPages();
|
||||
$config = $api->getConfig('site_title');
|
||||
return '<h1>' . htmlspecialchars($config) . '</h1>';
|
||||
```
|
||||
|
||||
#### Frontend URLs and file names
|
||||
The CMS searches files in order: `.md` → `.php` → `.html`. If files share the same name (e.g. `test.md` and `test.php`), `/nl/test` always opens `test.md`. To open a specific file type, add the extension to the URL:
|
||||
- `/nl/test` → opens `test.md` (or `.php` / `.html` if `.md` doesn't exist)
|
||||
- `/nl/test.php` → opens `test.php` (explicit extension)
|
||||
- `/nl/test.html` → opens `test.html` (explicit extension)
|
||||
|
||||
The preview link in the editor automatically uses the extension for non-`.md` files.
|
||||
|
||||
### Set image size (Markdown)
|
||||
The markdown editor toolbar has an "Image size" button (expand icon):
|
||||
1. Select an image in the editor in markdown format ``
|
||||
@@ -41,7 +60,7 @@ Images in `content/` are served via the `/-media/` endpoint (content/ lives outs
|
||||
- Enter a path within content (e.g. `en.page` or `blog/en.post`)
|
||||
- Choose the file type (Markdown/PHP/HTML)
|
||||
- Subfolders are created automatically
|
||||
- Frontmatter with `layout`, `author_name`, `author_email`, `created` is auto-generated
|
||||
- Frontmatter with `layout`, `created`, `edited` is auto-generated
|
||||
|
||||
### Upload a file
|
||||
- Click **Upload** to upload files to `content/`
|
||||
@@ -62,27 +81,22 @@ Images in `content/` are served via the `/-media/` endpoint (content/ lives outs
|
||||
On the editor page you can choose the layout from the layouts defined in `theme.json` (template mapping). The selected layout is stored in the frontmatter `layout:` key.
|
||||
|
||||
### Plugins on pages
|
||||
- Content plugins (from `plugin.json` with `type: "content"`) appear in the plugin selection
|
||||
- Choose which plugins run on the page
|
||||
- Only active **content plugins** (from `plugin.json` with `type: "content"`) appear in the plugin multiselect; system plugins (like Statistics/Logs/Dashboard) are excluded
|
||||
- Choose which plugins run on the page via the multiselect (use Ctrl/Cmd+click for multiple)
|
||||
- The plugin selection is stored in the frontmatter `plugins:` key
|
||||
|
||||
### Git / Backup integration (Phase 5)
|
||||
At the top of the content editor there are backup and git actions:
|
||||
- **Git init**: initializes a git repository in `content/` (if none exists yet)
|
||||
- **Commit**: commits all uncommitted changes (only if there is a git repo and there are changes)
|
||||
- **Backup**: link to the backup page (`/admin/content-backup`) for ZIP backup/restore
|
||||
- The git status badge shows the current branch, whether there are uncommitted changes, and the last commit
|
||||
### Backup integration
|
||||
At the top of the content editor there is a **Backup** button linking to the backup page (`/admin/content-backup`) for ZIP backup/restore and (if available) git versioning. Git integration in the editor sidebar has been removed; git will become a system plugin later.
|
||||
|
||||
### Frontmatter
|
||||
|
||||
The editor updates the frontmatter live when layout or plugin selection changes:
|
||||
The editor shows the **Created** and **Edited** timestamps (read-only, automatically updated on every save). The `edited:` value is refreshed on each save.
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
author_name: Admin
|
||||
author_email: admin@example.com
|
||||
created: 2026-08-19 10:30:25
|
||||
edited: 2026-08-20 14:22:01
|
||||
plugins: HTMLBlock, Navigation
|
||||
---
|
||||
|
||||
@@ -91,24 +105,6 @@ plugins: HTMLBlock, Navigation
|
||||
Content...
|
||||
```
|
||||
|
||||
## List view (content)
|
||||
|
||||
### Managing files
|
||||
|
||||
- **New folder** — Create folder structure
|
||||
- **New file** — Create a page (`.md`, `.php`, `.html`)
|
||||
- **Edit** — Modify existing content in the CodeMirror editor
|
||||
- **Rename** — Change file or folder names
|
||||
- **Move** — Move content to another folder
|
||||
- **Delete** — Remove content
|
||||
- **Rename folder** — Change a folder name
|
||||
|
||||
### Editor (content-edit)
|
||||
|
||||
- **CodeMirror** with syntax highlighting (Markdown, PHP, HTML)
|
||||
- **Toolbar** for quickly inserting Markdown
|
||||
- **Shortcuts**: Ctrl+S (save), Ctrl+N (new)
|
||||
|
||||
## Frontmatter
|
||||
|
||||
The editor updates the frontmatter live when layout or plugin selection changes:
|
||||
@@ -116,9 +112,9 @@ The editor updates the frontmatter live when layout or plugin selection changes:
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
plugins:
|
||||
- HTMLBlock
|
||||
- Navigation
|
||||
created: 2026-08-19 10:30:25
|
||||
edited: 2026-08-20 14:22:01
|
||||
plugins: HTMLBlock, Navigation
|
||||
---
|
||||
|
||||
# Page title
|
||||
|
||||
Reference in New Issue
Block a user