- Add language support documentation - Document all template variables and configuration options - Add URL structure and routing information - Include directory listings and file naming conventions - Document search functionality and SEO features - Add breadcrumb navigation and theme customization - Include security features and responsive design - Update both English and Dutch guides Guides now cover all CodePress CMS features and functions.
7.4 KiB
7.4 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
- Write permissions for content directory
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 four content types:
Markdown (.md)
# Page Title
This is page content in **Markdown** format with CommonMark extensions.
## Subsection
- [x] Task list item
- [ ] Another task
- **Bold** and *italic* text
- [Auto-linked pages](?page=another-page)
PHP (.php)
<?php
$title = "Dynamic Page";
?>
<h1><?php echo htmlspecialchars($title); ?></h1>
<p>This is dynamic content with PHP.</p>
HTML (.html)
<h1>HTML Page</h1>
<p>This is static HTML content.</p>
Directory Listings
Directories automatically generate listings:
- File information (size, dates)
- Navigation to subdirectories
- Responsive file listing layout
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.
Language Support
- Browser detection: Automatic language detection
- URL switching:
?lang=enor?lang=nl - Language prefixes:
en.page.mdandnl.page.md - Translation files:
lang/en.phpandlang/nl.php
Search Functionality
- Full-text search: Search through all content
- Search URL:
?search=queryfor bookmarkable searches - Result highlighting: Search terms highlighted in results
- File and content search: Searches both filenames and 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 Info
{{site_title}}- Website title{{author_name}}- Author name{{author_website}}- Author website{{author_git}}- Git repository link
Page Info
{{page_title}}- Page title (filename without extension){{content}}- Page content (HTML){{file_info}}- File information (dates, size){{is_homepage}}- Boolean: is this the homepage?
Navigation
{{menu}}- Navigation menu{{breadcrumb}}- Breadcrumb navigation{{homepage}}- Homepage link{{homepage_title}}- Homepage title
Theme
{{header_color}}- Header background color{{header_font_color}}- Header text color{{navigation_color}}- Navigation background color{{navigation_font_color}}- Navigation text color
Language
{{current_lang}}- Current language (en/nl){{current_lang_upper}}- Current language (EN/NL){{available_langs}}- Available languages{{t_*}}- Translated strings (t_home, t_search, etc.)
SEO
{{seo_description}}- Meta description{{seo_keywords}}- Meta keywords
Features
{{has_content}}- Boolean: is content available?{{show_site_link}}- Boolean: show site link?{{is_guide_page}}- Boolean: is this the guide page?
Configuration
Basic Settings
Edit config.json in your project root:
{
"site_title": "Your Website Name",
"content_dir": "content",
"templates_dir": "engine/templates",
"default_page": "auto",
"language": {
"default": "en",
"available": ["en", "nl"]
},
"theme": {
"header_color": "#0a369d",
"header_font_color": "#ffffff",
"navigation_color": "#2754b4",
"navigation_font_color": "#ffffff"
},
"author": {
"name": "Your Name",
"website": "https://yourwebsite.com",
"git": "https://github.com/youruser/codepress"
},
"seo": {
"description": "Your website description",
"keywords": "cms, php, content management"
},
"features": {
"auto_link_pages": true,
"search_enabled": true,
"breadcrumbs_enabled": true
}
}
SEO Friendly URLs
CodePress automatically generates clean URLs:
home.md→?page=homeblog/article.md→?page=blog/articlenl.page.md→?page=nl.page&lang=nl
Language Support
- Browser detection: Automatic language detection
- URL switching:
?lang=enor?lang=nl - Language prefixes:
en.page.mdandnl.page.md - Directory precedence: Directories take precedence over files
Search Functionality
The built-in search function searches through:
- File names
- Content of Markdown/PHP/HTML files
- Search URL:
?search=queryfor bookmarkable searches - Result highlighting and snippets
Directory Listings
- Auto-generation:
?page=directoryshows directory contents - File information: Creation/modification dates and sizes
- Navigation: Links to files and subdirectories
Tips and Tricks
Page Organization
- Use subdirectories for categories
- Give each directory an
index.mdfor an overview page - Keep file names short and descriptive
- Use language prefixes:
en.page.mdandnl.page.md - Directory names take precedence over files with same name
File Naming Conventions
- Lowercase names: Use lowercase for all files
- No spaces: Use hyphens (-) or underscores (_)
- Language prefixes:
en.ornl.for multilingual content - Display names:
file-name.mddisplays as "File Name" in menus - Special cases:
phpinfo→ "phpinfo",ict→ "ICT"
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.