Complete CodePress CMS refactoring

- 🏠 Refactored layout system with flexbox
- 🎨 Implemented tab-style navigation with dropdowns
- 📱 Added responsive design with mobile support
- 🔧 Enhanced template system with content type detection
- 📝 Added comprehensive documentation (guide.md, README.md)
- ⚙️ Improved security with proper file access control
- 🎨 Added meta tags for SEO and author attribution
- 📁 Fixed breadcrumb navigation and duplicate links
- 🗂️ Removed unused files and cleaned up project structure
- ⚙️ Added JSON configuration system with homepage detection
- 📱 Enhanced search functionality with snippet display
- 🔗 Implemented auto-linking between pages
- 📊 Added file metadata display in footer

Features:
- Multi-format content support (Markdown, PHP, HTML)
- Dynamic navigation with collapsible folders
- Full-text search across all content
- Responsive Bootstrap 5 design
- JSON-based configuration
- SEO-optimized meta tags
- Security-focused file management
- Mobile-first responsive design
- Auto-linking between pages
- File metadata tracking
- Breadcrumb navigation
- Custom CSS styling
- Progressive enhancement

Technical improvements:
- Replaced fixed positioning with flexbox layout
- Implemented proper template inheritance
- Added content type detection
- Enhanced security with .htaccess
- Optimized for performance
- Added proper error handling
- Implemented caching mechanisms
- Enhanced accessibility features
This commit is contained in:
2025-11-21 16:58:37 +01:00
parent a86809c243
commit dfe2df141b
28 changed files with 837 additions and 1800 deletions

306
README.md
View File

@@ -1,169 +1,203 @@
# CodePress CMS
A lightweight, file-based Content Management System built with PHP and Bootstrap.
Een lichtgewicht, file-based content management systeem gebouwd met PHP.
## Overview
## ✨ Features
CodePress is a modern, secure CMS that manages content through files instead of a database. It's designed for simplicity, flexibility, and ease of use while maintaining powerful features for content management.
- 📝 **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
## Features
## 🚀 Quick Start
### 🎯 Core Features
- **File-based content** - No database required
- **Multi-format support** - Markdown, PHP, HTML files
- **Dynamic navigation** - Auto-generated from directory structure
- **Search functionality** - Full-text search with snippets
- **Breadcrumb navigation** - Clear page hierarchy
- **Responsive design** - Works on all devices
1. **Upload** bestanden naar webserver
2. **Stel permissies** in voor webserver
3. **Configureer** (optioneel) via `config.json`
4. **Bezoek** website via browser
### 🔧 Advanced Features
- **Collapsible folders** - Accordion-style navigation
- **WCAG compliant** - Accessible design with proper contrast
- **File metadata** - Creation and modification dates in footer
- **Progressive styling** - Visual hierarchy with nested levels
- **Security** - Protected PHP files and sensitive directories
## Quick Start
1. **Requirements**: PHP 8.4+
2. **Installation**:
```bash
git clone https://git.noorlander.info/E.Noorlander/CodePress.git
cd CodePress
```
3. **Start server**:
```bash
# For Apache: Set DocumentRoot to public/
# For Development:
php -S localhost:8080 -t public router.php
```
4. **Visit**: `http://localhost:8080`
## Project Structure
## 📁 Project Structuur
```
codepress/
├── public/ # Web-accessible directory (DocumentRoot)
│ ├── index.php # Main entry point
│ ├── .htaccess # Apache security and routing
│ └── router.php # PHP development server router
├── content/ # Content files (MD/PHP/HTML) - outside web root
├── engine/ # CMS engine and assets
├── core/ # PHP application logic
│ │ ├── index.php # CMS class and logic
└── config.php # Site configuration
├── templates/ # HTML templates
└── assets/ # Static assets (CSS, JS, fonts)
│ ├── css/ # Bootstrap and custom CSS
── js/ # JavaScript files
│ └── fonts/ # Font files
├── .htaccess # Root security
└── README.md # This documentation
├── 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
```
## Security
## ⚙️ Configuratie
CodePress includes built-in security features:
- **Content isolation** - Content files stored outside web root
- **.htaccess protection** for sensitive files and directories
- **Direct access blocking** - Content files not accessible via URL
- **Security headers** for XSS protection
- **PHP file blocking** in content directory
- **Offline capable** - All assets (Bootstrap) stored locally
- **Directory access control**
### Basis Configuratie (`config.json`)
## Content Management
### Supported File Types
#### Markdown (.md)
```markdown
# Page Title
Content with **bold** and *italic* text.
[Link to page](?page=other/page)
```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"
}
}
```
#### PHP (.php)
```php
<?php
$title = "Dynamic Page";
$date = date('Y-m-d');
?>
### Configuratie Opties
<h1><?php echo $title; ?></h1>
<p>Date: <?php echo $date; ?></p>
- **`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
```
#### HTML (.html)
```html
<h1>Static HTML Page</h1>
<div class="alert alert-info">
Custom HTML content
</div>
### 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>
```
### Directory Structure
```
content/
├── home.md # Homepage
├── about/
│ └── company.md # About page
├── blog/
│ ├── tech/
│ │ └── post.md # Blog post
│ └── index.md # Blog overview
└── projects/
└── web-design.md # Project page
#### Nginx
```nginx
server {
root /var/www/codepress/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
```
## Configuration
## 📖 Documentatie
Edit `config.php` to customize:
- **[Handleiding (NL)](guide/nl.md)** - Gedetaillede handleiding
- **[Handleiding (EN)](guide/en.md)** - English documentation
- **[AGENTS.md](AGENTS.md)** - Ontwikkelaar instructies
```php
return [
'site_title' => 'Your Site Name',
'site_description' => 'Your site description',
'content_dir' => __DIR__ . '/../../content',
'templates_dir' => __DIR__ . '/../templates',
'default_page' => 'home',
'markdown_enabled' => true,
'php_enabled' => true,
];
```
## 🤝 Bijdragen
## Branches
Bijdragen zijn welkom! Zie [AGENTS.md](AGENTS.md) voor ontwikkelrichtlijnen.
- **main**: Clean CodePress CMS with documentation
- **e.noorlander**: Personal blog content and customizations
- **development**: Active development branch
## 📄 Licentie
## Development
Open-source licentie. Zie de repository voor meer informatie.
### Adding Features
1. Create feature branch from `development`
2. Implement changes
3. Test thoroughly
4. Submit merge request
## 🔗 Links
### Contributing
- Follow PSR-12 coding standards
- Test security implications
- Update documentation
- Maintain backward compatibility
## License
This project is developed for specific use cases. Contact the maintainer for licensing information.
## Support
- **Documentation**: See `content/home.md`
- **Issues**: Report on GitLab
- **Community**: Join discussions
- **Website**: https://noorlander.info
- **Repository**: https://git.noorlander.info/E.Noorlander/CodePress.git
- **Issues**: https://git.noorlander.info/E.Noorlander/CodePress/issues
---
*Built with ❤️ and PHP*
*Gebouwd met ❤️ door Edwin Noorlander*