| description | hidden |
|---|---|
Markdown based Content Management System in Elements |
true |
The CMS Components in Elements require PHP 8.x or newer. You must ensure all CMS related pages use a .php extension.
These components are used as wrappers, or container, components. You should place other components inside of these. Components placed inside these components will gain access to CMS data.
| CMS Component | Description |
|---|---|
| Static Item | Wrapper for fetching a single item from the CMS. |
| Collection | Wrapper for fetching a collection (folder) og items. |
| Collection Item | Used for Collection page templates. Will fetch the requested Collection Item based on the slug in the URL. |
| Collection Search | Adds instant search for any collection. |
These components should be placed inside the wrapper components. These components have access to CMS data, such as as the title, date, author, body, and so on.
| Component | Description |
|---|---|
| Body | Used to access the body of an item. |
| Item Author | Display the author for the current item. |
| Item Tags | Display tags for the current item. |
| Related Items | Display items related to the current item. Must be placed inside a Static Item or Collection Item. |
| Collection Pagination | Adds pagination links to any collection. Must be placed inside a Collection. |
| Conditional | Conditionally display content. |
The built-in CMS system in Element requires a specific file and folder setup to work. You must ensure all blog related pages use a .php extension.
Content should be stored as Markdown down files inside a dedicated folder.
- cms
- posts
- 2025-04-18-my-first-post.md
- 2025-04-19-another-blog-post.md
- posts
The structure for the Markdown file:
---
title: "An Example Post"
date_published: "2025-04-20"
author: Steve
tags: [technology]
status: published
feature_image: blog/myimage.jpg
featured: true
---
This is the contents of my first post.
You can create additional metadata about Authors by organizing a folder structure with supplementary markdown files. In this example, the authors folder is placed at the same level as the "posts" folder.
- cms
- posts
- authors
- steve.md
- jasmin.md
The structure for the Authors Markdown file:
---
name: "Steve"
avatar: blog/steve-photo.png
---
This is all about Steve.
Any page with a CMS collection can provide an RSS feed. Simply append ?format=rss to the end of the URL, like this yourwebsite.com/blog/?format=rss .
A $post array containing the post's information is available to any component placed inside a Collection or Item component.
| Name | Type | Example |
|---|---|---|
| author | array | <?=$post['author']?> |
| author.avatar | string | null | <?=$post['author']['avatar']?> |
| author.bio | string | null | <?=$post['author']['bio']?> |
| author.name | string | <?=$post['author']['name']?> |
| author.slug | string | <?=$post['author']['slug']?> |
| body | string | <?=$post['body']?> |
| date_published | string | <?=$post['date_published']?> |
| featured | boolean | <?=$post['featured']?> |
| feature_image | string | <?=$post['feature_image']?> |
| slug | string | <?=$post['slug']?> |
| status | string | <?=$post['status']?> |
| tags | array | <?=$post['tags']?> |
| title | string | <?=$post['title']?> |