Developing for the CMS
The Elements CMS is a powerful content management system designed for RapidWeaver elements, providing a flexible and efficient way to manage content through markdown files with YAML front matter.
Last updated
Was this helpful?
The Elements CMS is a powerful content management system designed for RapidWeaver elements, providing a flexible and efficient way to manage content through markdown files with YAML front matter.
Last updated
Was this helpful?
To initialize the CMS in your PHP code:
Collections are groups of content items stored in markdown files. Each collection is stored in a directory, with each item represented by a markdown file.
Items are individual content pieces stored as markdown files with YAML front matter. The filename format can be either:
YYYY-MM-DD-slug.md
(for dated content)
slug.md
(for undated content)
Example item structure:
The CMS includes a powerful search system that can be used in two ways:
The CMS provides a search endpoint at search.php
that accepts the following parameters:
q
: Search query
collectionPath
: Path to the collection
detailPageUrl
: URL for detail pages
prettyUrls
: Whether to use pretty URLs
basePath
: Base path for content
template
: HTML template for rendering results, can include Twig syntax
Example AJAX call:
The search system automatically maintains an index file (search-index.json
) in the collection directory for improved performance. The index is automatically rebuilt when content changes are detected.
The CMS provides a fluent interface for finding related items:
File Organization
Keep collections in separate directories
Use consistent naming conventions for files
Include all necessary metadata in front matter
Performance
Use caching when appropriate
Implement pagination for large collections
Optimize search queries
Content Structure
Use consistent front matter fields
Include required metadata (title, date, status)
Properly format markdown content
Security
Validate user input
Sanitize output
Use proper file permissions
The CMS requires the following PHP packages:
Symfony YAML
CommonMark
Illuminate Collections
Twig (for template rendering)
The CMS includes built-in error handling for common scenarios:
Invalid file paths
Missing required metadata
Malformed YAML front matter
Search index issues
For issues, feature requests, or contributions, please refer to the project's issue tracker or documentation repository.