- Fix getPage() to search for language-specific files (en.test.md, nl.test.md) - Correct guide file naming: uk.codepress.md → en.codepress.md - Update scanDirectory() filtering: uk → en for consistency - Update formatDisplayName() cleaning: uk → en for consistency - Language-specific pages now load correctly without 404 errors - Pages display with clean names (without language prefixes)
3.7 KiB
3.7 KiB
CodePress CMS Guide
Welcome to CodePress CMS
CodePress is a lightweight, file-based Content Management System built with PHP and Bootstrap.
Table of Contents
Getting Started
Requirements
- PHP 8.4+
- Web server (Apache/Nginx)
- Modern web browser
Installation
- Clone or download the CodePress files
- Upload to your web server
- Make sure the
content/directory is writable - Navigate to your website in the browser
Basic Configuration
The most important settings are in engine/core/config.php:
$config = [
'site_title' => 'My Website',
'default_page' => 'home',
'content_dir' => __DIR__ . '/../../content',
'templates_dir' => __DIR__ . '/../templates'
];
Content Management
File Structure
content/
├── home.md # Home page
├── blog/
│ ├── index.md # Blog overview
│ ├── article-1.md # Blog article
│ └── category/
│ └── article.md # Article in category
└── about-us/
└── info.md # About us page
Content Types
CodePress supports three content types:
Markdown (.md)
# Page Title
This is the page content in **Markdown** format.
## Subsection
- List item 1
- List item 2
PHP (.php)
<?php
$title = "Dynamic Page";
?>
<h1><?php echo $title; ?></h1>
<p>This is dynamic content with PHP.</p>
HTML (.html)
<h1>HTML Page</h1>
<p>This is static HTML content.</p>
Automatic Linking
CodePress automatically creates links to other pages when you mention page names in your content.
Templates
Template Structure
CodePress uses Mustache-compatible templates:
layout.mustache- Main templateassets/header.mustache- Header componentassets/sidebar.mustache- Sidebar navigationassets/footer.mustache- Footer component
Template Variables
Available variables in templates:
{{site_title}}- Website title{{page_title}}- Current page title{{content}}- Page content{{menu}}- Navigation menu{{breadcrumb}}- Breadcrumb navigation
Configuration
Basic Settings
Edit engine/core/config.php for your website:
$config = [
'site_title' => 'Your Website Name',
'default_page' => 'home', // Default start page
'content_dir' => __DIR__ . '/../../content',
'templates_dir' => __DIR__ . '/../templates'
];
SEO Friendly URLs
CodePress automatically generates clean URLs:
home.md→/homeblog/article.md→/blog/article
Search Functionality
The built-in search function searches through:
- File names
- Content of Markdown/PHP/HTML files
Tips and Tricks
Page Organization
- Use subdirectories for categories
- Give each directory an
index.mdfor an overview page - Keep file names short and descriptive
Content Optimization
- Use clear headings (H1, H2, H3)
- Add descriptive meta information
- Use internal links for better navigation
Security
- Keep your CodePress installation updated
- Restrict write permissions on the
content/directory - Use HTTPS when possible
Support
Troubleshooting
- Empty pages: Check file permissions
- Template errors: Verify template syntax
- 404 errors: Check file names and paths
More Information
- Documentation: CodePress GitHub
- Issues and feature requests: GitHub Issues
This guide is part of CodePress CMS and is automatically displayed when no content is available.