CodePress/README.md
Edwin Noorlander 863661612a ## Major CodePress CMS Enhancement
### 🚀 New Features
- **League CommonMark Integration**: Replaced basic Markdown parser with full CommonMark 2.7 support
- **Bootstrap Sass Architecture**: Modern SCSS build system with Bootstrap 5.3.8
- **Enhanced Navigation**: Uses filenames instead of H1 titles for consistency
- **Improved Styling**: Transparent navigation backgrounds, no rounded corners

### 🎨 UI/UX Improvements
- Navigation items now use formatted filenames (e.g., "kennis-boven-aantallen" → "Kennis Boven Aantallen")
- Transparent navigation backgrounds with subtle hover effects
- Removed rounded corners from first-level navigation
- 50% opacity navigation background using Bootstrap variables

### 🔧 Technical Improvements
- **Class Organization**: Extracted CodePressCMS and SimpleTemplate to separate files
- **Full PHPDoc Documentation**: Complete documentation for all methods
- **Modern Build Process**: npm scripts for SCSS compilation
- **Enhanced Markdown Support**: Tables, strikethrough, task lists, autolinks
- **Security**: Proper HTML sanitization with CommonMark

### 📦 Dependencies
- Added `league/commonmark` for professional Markdown parsing
- Added `bootstrap` for SCSS-based styling
- Updated `sass` build process

### 🐛 Bug Fixes
- Fixed content directory path configuration
- Resolved navigation title inconsistencies
- Improved Markdown bold/italic formatting
- Fixed homepage 404 issues

### 🔄 Migration Notes
- Content directory moved from `content/` to `public/content/`
- Navigation now displays filenames instead of content H1 titles
- CSS now compiled from SCSS source files

The CMS now provides a professional, modern experience with robust Markdown support and clean, maintainable code architecture.
2025-11-21 20:23:20 +01:00

251 lines
6.9 KiB
Markdown

# CodePress CMS
Een lichtgewicht, file-based content management systeem gebouwd met PHP.
## ✨ Features
- 📝 **Multi-format Content** - Ondersteunt Markdown, PHP en HTML bestanden
- 🧭 **Dynamic Navigation** - Automatische menu generatie met dropdowns
- 🔍 **Search Functionality** - Volledige tekst zoek door alle content
- 🧭 **Breadcrumb Navigation** - Intuïtieve navigatiepaden
- 🔗 **Auto-linking** - Automatische links tussen pagina's
- 📱 **Responsive Design** - Werkt perfect op alle apparaten
- ⚙️ **JSON Configuratie** - Eenvoudige configuratie via JSON
- 🎨 **Bootstrap 5** - Moderne UI framework
- 🔒 **Security** - Beveiligde content management
## 🚀 Quick Start
1. **Upload** bestanden naar webserver
2. **Stel permissies** in voor webserver
3. **Configureer** (optioneel) via `config.json`
4. **Bezoek** website via browser
## 📁 Project Structuur
```
codepress/
├── engine/
│ ├── core/
│ │ ├── config.php # Configuratie loader
│ │ └── index.php # CMS engine
│ └── templates/ # Template bestanden
│ ├── layout.mustache
│ ├── assets/
│ │ ├── header.mustache
│ │ ├── navigation.mustache
│ │ └── footer.mustache
│ ├── markdown_content.mustache
│ ├── php_content.mustache
│ └── html_content.mustache
├── content/ # Content bestanden
│ ├── map1/
│ │ ├── pagina1.md
│ │ └── pagina2.php
│ └── homepage.md
├── public/ # Web root
│ ├── assets/
│ │ ├── css/
│ │ ├── js/
│ │ └── favicon.svg
│ └── index.php
├── config.json # Configuratie
└── README.md
```
## ⚙️ Configuratie
### Basis Configuratie (`config.json`)
```json
{
"site_title": "CodePress",
"content_dir": "content",
"templates_dir": "engine/templates",
"default_page": "auto",
"homepage": "homepage",
"author": {
"name": "Edwin Noorlander",
"website": "https://noorlander.info",
"git": "https://git.noorlander.info/E.Noorlander/CodePress.git"
},
"seo": {
"description": "CodePress CMS - Lightweight file-based content management system",
"keywords": "cms, php, content management, file-based"
}
}
```
### Configuratie Opties
- **`site_title`** - Naam van de website
- **`content_dir`** - Map met content bestanden
- **`templates_dir`** - Map met template bestanden
- **`default_page`** - Standaard pagina (`"auto"` voor automatische detectie)
- **`homepage`** - Homepage (`"auto"` voor automatische detectie)
- **`author`** - Auteur informatie met links
- **`seo`** - SEO instellingen
## 📝 Content Types
### Markdown (.md)
- Auto-linking tussen pagina's
- GitHub Flavored Markdown ondersteuning
- Syntax highlighting voor code blocks
- Automatische titel extractie
### PHP (.php)
- Volledige PHP ondersteuning
- Dynamische content generatie
- Database integratie mogelijk
- Session management beschikbaar
### HTML (.html)
- Statische HTML pagina's
- Bootstrap componenten
- Custom CSS en JavaScript
- Volledige HTML5 validatie
## 🎨 Design Features
### Navigation
- **Tab-style navigatie** met Bootstrap
- **Dropdown menus** voor mappen en sub-mappen
- **Home knop** met icoon
- **Active state** indicatie
- **Responsive** hamburger menu
### Layout
- **Flexbox layout** voor moderne structuur
- **Fixed header** met logo en zoekfunctie
- **Breadcrumb navigatie** tussen header en content
- **Fixed footer** met metadata
- **Scrollable content** gebied
### Responsive
- **Mobile-first** aanpak
- **Touch-friendly** interactie
- **Adaptieve** breedtes
- **Consistente** ervaring
## 🔧 Vereisten
- **PHP 8.4+** of hoger
- **Webserver** (Apache, Nginx, etc.)
- **Schrijfrechten** voor PHP bestanden
- **Mod_rewrite** (optioneel voor pretty URLs)
## 🛠️ Installatie
### Via Composer
```bash
composer create-project codepress
cd codepress
```
### Handmatig
1. **Download** de bestanden
2. **Upload** naar webserver
3. **Stel permissies** in
4. **Configureer** `config.json`
### Webserver Configuratie
#### Apache
```apache
<Directory "/var/www/codepress">
AllowOverride All
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
```
#### Nginx
```nginx
server {
root /var/www/codepress/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
```
## 🏗️ PHP Classes
### SimpleTemplate Class
Lightweight template rendering engine die Mustache-style syntax ondersteunt zonder externe dependencies.
**Methods:**
- `render($template, $data)` - Rendert template met data
- `replacePartial($matches)` - Vervangt `{{>partial}}` placeholders
**Features:**
- `{{>partial}}` - Partial includes
- `{{#variable}}...{{/variable}}` - Conditionele blocks
- `{{^variable}}...{{/variable}}` - Negatieve conditionele blocks
- `{{{variable}}}` - Unescaped HTML content
- `{{variable}}` - Escaped content
### CodePressCMS Class
Hoofd CMS class die alle content management functionaliteit beheert.
**Public Methods:**
- `__construct($config)` - Initialiseer CMS met configuratie
- `getPage()` - Haalt huidige pagina content op
- `getMenu()` - Genereert navigatiestructuur
- `render()` - Rendert volledige pagina met templates
**Private Methods:**
- `buildMenu()` - Bouwt menu structuur van content directory
- `scanDirectory($dir, $prefix)` - Scant directory voor content
- `performSearch($query)` - Voert zoekopdracht uit
- `parseMarkdown($content)` - Converteert Markdown naar HTML
- `parsePHP($filePath)` - Verwerkt PHP bestanden
- `parseHTML($content)` - Verwerkt HTML bestanden
- `getBreadcrumb()` - Genereert breadcrumb navigatie
- `renderMenu($items, $level)` - Rendert menu HTML
- `getContentType($page)` - Bepaalt content type
- `autoLinkPageTitles($content)` - Auto-link pagina titels
**Features:**
- Multi-format content support (MD, PHP, HTML)
- Dynamische navigatie met dropdowns
- Zoekfunctionaliteit met snippets
- Breadcrumb navigatie
- Auto-linking tussen pagina's
- File metadata tracking
- Responsive template rendering
## 📖 Documentatie
- **[Handleiding (NL)](guide/nl.md)** - Gedetailleerde handleiding
- **[Handleiding (EN)](guide/en.md)** - English documentation
- **[AGENTS.md](AGENTS.md)** - Ontwikkelaar instructies
## 🤝 Bijdragen
Bijdragen zijn welkom! Zie [AGENTS.md](AGENTS.md) voor ontwikkelrichtlijnen.
## 📄 Licentie
Open-source licentie. Zie de repository voor meer informatie.
## 🔗 Links
- **Website**: https://noorlander.info
- **Repository**: https://git.noorlander.info/E.Noorlander/CodePress.git
- **Issues**: https://git.noorlander.info/E.Noorlander/CodePress/issues
---
*Gebouwd met ❤️ door Edwin Noorlander*