CodePress/guide/nl.codepress.md
Edwin Noorlander 60276cdccd Fix security vulnerabilities, remove dead code, and improve code quality
- Fix path traversal with realpath() validation in getPage() and executePhpFile()
- Remove insecure JWT secret fallback, require JWT_SECRET env var
- Fix IP spoofing by only trusting proxy headers from configured proxies
- Add Secure/HttpOnly/SameSite flags to all cookies
- Use env var for debug mode instead of hardcoded true
- Fix operator precedence bug in MQTTTracker track_user_flows check
- Remove dead code: duplicate is_dir() block, unused scanForPageNames()
- Remove htmlspecialchars() from filesystem path operations
- Remove duplicate require_once calls and redundant autoloader includes
- Fix unclosed </div> in getDirectoryListing()
- Escape breadcrumb titles and add lang param to search result URLs
- Make language prefixes dynamic from config instead of hardcoded nl|en
- Make HTML lang attribute dynamic, add go_to translation key
- Add aria-label/aria-expanded to sidebar toggle for accessibility
- Fix event listener leak in app.js using event delegation
- Remove console.log from production code
- Update guides (NL/EN) with sidebar toggle documentation
- Add TODO.md documenting all identified improvements
2026-02-16 15:05:27 +01:00

6.9 KiB

CodePress CMS Handleiding

Overzicht

CodePress CMS is een lichtgewicht, file-based content management systeem gebouwd met PHP. Werkt zonder database.

Functies

🏠 Navigatie

  • Tab-style navigatie met Bootstrap styling
  • Dropdown menus voor mappen en sub-mappen
  • Home knop met icoon
  • Automatische menu generatie
  • Responsive design
  • Breadcrumb navigatie met sidebar toggle
  • Active state marking
  • Sidebar toggle - Knop links van HOME in de breadcrumb om de sidebar te openen/sluiten. Het icoon wisselt tussen open en gesloten status. De keuze blijft behouden tijdens de sessie

📄 Content Types

  • Markdown (.md) - CommonMark ondersteuning
  • PHP (.php) - Dynamische content
  • HTML (.html) - Statische HTML pagina's
  • Directory listings - Automatische directory overzichten
  • Language-specific content - nl. en en. prefix

🔍 Zoekfunctionaliteit

  • Volledige tekst zoek door alle content
  • Resultaten met snippets en highlighting
  • Directe navigatie naar gevonden pagina's
  • SEO-vriendelijke zoekresultaten
  • Search URL: ?search=zoekterm

🧭 Configuratie

  • JSON configuratie in config.json
  • Dynamische homepage instelling
  • SEO instellingen (description, keywords)
  • Author informatie met links
  • Thema configuratie met kleuren
  • Language settings
  • Feature toggles

🎨 Layout & Design

  • Flexbox layout voor responsive structuur
  • Fixed header met logo en zoekfunctie
  • Breadcrumb navigatie
  • Fixed footer met file info en links
  • Bootstrap 5 styling
  • Mustache templates
  • Semantic HTML5 structuur
  • Dynamic layouts met YAML frontmatter
  • Sidebar support met plugin integratie en toggle functie via breadcrumb

Installatie

  1. Upload bestanden naar webserver
  2. Stel permissies in voor webserver
  3. Configureer config.json indien nodig
  4. Toegang tot website via browser

Configuratie

Basis Configuratie (config.json)

```json { "site_title": "CodePress", "content_dir": "content", "templates_dir": "engine/templates", "default_page": "auto", "language": { "default": "nl", "available": ["nl", "en"] }, "theme": { "header_color": "#0a369d", "header_font_color": "#ffffff", "navigation_color": "#2754b4", "navigation_font_color": "#ffffff", "sidebar_background": "#f8f9fa", "sidebar_border": "#dee2e6" }, "author": { "name": "E. Noorlander", "website": "https://noorlander.info" }, "seo": { "description": "CodePress CMS - Lightweight file-based content management system", "keywords": "cms, php, content management, file-based" }, "features": { "auto_link_pages": true, "search_enabled": true, "breadcrumbs_enabled": true } } ```

Content Structuur

Bestandsstructuur

``` content/ ├── map1/ │ ├── submap1/ │ │ ├── pagina1.md │ │ └── pagina2.php │ └── pagina3.html ├── map2/ │ └── pagina4.md ├── homepage.md └── index.html ```

Bestandsnamen

  • Gebruik lowercase bestandsnamen
  • Geen spaties - gebruik - of _
  • Logische extensies - .md, .php, .html
  • Unieke namen - geen duplicaten
  • Language prefixes - nl.bestand.md en en.bestand.md

Templates

Template Variabelen

Site Info

  • site_title - Website titel
  • author_name - Auteur naam
  • author_website - Auteur website
  • author_git - Git repository link

Page Info

  • page_title - Pagina titel
  • content - Content (HTML)
  • file_info - Bestandsinformatie
  • is_homepage - Boolean: is dit de homepage?

Navigation

  • menu - Navigatie menu
  • breadcrumb - Breadcrumb navigatie
  • homepage - Homepage link

Theme

  • header_color - Header achtergrondkleur
  • header_font_color - Header tekstkleur
  • navigation_color - Navigatie achtergrondkleur
  • navigation_font_color - Navigatie tekstkleur

Language

  • current_lang - Huidige taal (nl/en)
  • current_lang_upper - Huidige taal (NL/EN)
  • t_* - Vertaalde strings

URL Structuur

Basis URLs

  • Home: / of ?page=home
  • Pagina: ?page=map/pagina
  • Zoeken: ?search=zoekterm
  • Handleiding: ?guide
  • Language: ?lang=nl of ?lang=en

SEO Optimalisatie

Meta Tags

De CMS voegt automatisch meta tags toe: ```html

\`\`\`

🔌 Plugin Systeem

Plugin Structuur

``` plugins/ ├── README.md ├── HTMLBlock/ │ ├── HTMLBlock.php │ └── README.md └── MQTTTracker/ ├── MQTTTracker.php ├── config.json └── README.md ```

Plugin Development

  • API toegang via CMSAPI class
  • Sidebar content met getSidebarContent()
  • Metadata toegang uit YAML frontmatter
  • Configuratie via JSON bestanden

Beschikbare Plugins

  • HTMLBlock - Custom HTML blokken in sidebar
  • MQTTTracker - Real-time analytics en tracking

🎯 Template Systeem

Layout Opties

Gebruik YAML frontmatter om layout te selecteren:

```yaml

title: Mijn Pagina layout: sidebar-content

```

Beschikbare Layouts

  • sidebar-content - Sidebar links, content rechts (standaard)
  • content - Alleen content (volle breedte)
  • sidebar - Alleen sidebar
  • content-sidebar - Content links, sidebar rechts
  • content-sidebar-reverse - Content rechts, sidebar links

Meta Data

```yaml

title: Pagina Titel layout: content-sidebar description: Pagina beschrijving author: Auteur Naam date: 2025-11-26

```

📊 Analytics & Tracking

MQTT Tracker

  • Real-time page tracking
  • Session management
  • Business Intelligence data
  • Privacy aware (GDPR compliant)
  • MQTT integration voor dashboards

Veelgestelde Vragen

Hoe stel ik de homepage in?

  1. Automatisch: Laat de CMS het eerste bestand kiezen
  2. Handmatig: Stel "default_page": "pagina-naam" in config.json

Hoe werkt de navigatie?

  • Mappen worden dropdown menus
  • Bestanden worden directe links
  • Sub-mappen worden geneste dropdowns

Hoe voeg ik nieuwe content toe?

  1. Upload bestanden naar de content/ map
  2. Organiseer in logische mappen
  3. Gebruik juiste bestandsnamen en extensies

Troubleshooting

Pagina niet gevonden (404)

  1. Controleer bestandsnaam en pad
  2. Controleer bestandsextensie (.md, .php, .html)
  3. Controleer permissies van bestanden

Navigatie niet bijgewerkt

  1. Herlaad de pagina
  2. Controleer content map structuur
  3. Controleer bestandsnamen (geen spaties)

Ondersteuning

Voor technische ondersteuning:

Licentie

CodePress CMS is open-source software.