{{title}}
{{#if date}} {{/if}} {{#if author}} {{/if}}No blog posts found.
{{/if}}This document provides a comprehensive reference for the FearlessCMS template system, including all available variables, syntax, and examples.
FearlessCMS uses a simple template system with double curly braces {{}}
for variables and special tags for conditionals and loops.
| Variable | Description | Example |
|----------|-------------|---------|
| {{siteName}}
| Site name from config | "My Awesome Site" |
| Fast and Fearless Content Managment
| Site description/tagline | "A great website" |
| {{theme}}
| Current theme name | "nightfall" |
| 2025
| Current year | "2024" |
| {{baseUrl}}
| Base URL of the site | "https://example.com" |
| {{currentUrl}}
| Current page URL | "/about" |
| Variable | Description | Example |
|----------|-------------|---------|
| {{title}}
| Page title | "About Us" |
| {{content}}
| Page content (HTML) | "
Page content...
" | |{{url}}
| Current page URL | "about" |
| {{parent}}
| Parent page object | {"title": "Home", "url": "home"}
|
| {{children}}
| Array of child pages | [{"title": "Child 1", "url": "child1"}]
|
| {{excerpt}}
| Page excerpt (first paragraph) | "This is the excerpt..." |
| {{date}}
| Page creation date | "2024-01-15" |
| {{author}}
| Page author | "John Doe" || Variable | Description | Example |
|----------|-------------|---------|
| {{menu.main}}
| Main menu items | Array of menu objects |
| {{menu.footer}}
| Footer menu items | Array of menu objects |
| {{menu.sidebar}}
| Sidebar menu items | Array of menu objects |
| Variable | Description | Example |
|----------|-------------|---------|
| {{themeOptions.key}}
| Custom theme option | Value depends on theme |
| Variable | Description | Example |
|----------|-------------|---------|
| full-featured
| Current CMS mode identifier | "full-featured", "hosting-service-plugins" |
| false
| Boolean indicating hosting service mode | true, false |
| Full Featured
| Human-readable mode name | "Full Featured", "Hosting Service (Plugin Mode)" |
html
{{#if condition}}
{{else}}
{{/if}}
html
{{#if title}}
{{title}}
{{/if}}
{{#if children}}
{{#each children}}
- {{title}}
{{/each}}
{{/if}}
{{#if themeOptions.showSidebar}}
{{/if}}
{{#if title && content}}
{{title}}
{{content}}
{{else}}
No content available
{{/if}}
{{#if isHostingServiceMode}}
This site is hosted by our premium hosting service.
{{/if}}
{{#if cmsMode === "hosting-service-plugins"}}
Plugin management is available in this mode.
{{/if}}
html
{{#each array}}
{{/each}}
html
{{#if children}}
{{#each children}}
{{title}}
{{#if excerpt}}
{{excerpt}}
{{/if}}
{{/each}}
{{/if}}
{{#if themeOptions.socialLinks}}
{{/if}}
Include other template files:
html
{{include "partials/header.html"}}
{{include "partials/footer.html"}}
Format dates using PHP's date format:
html
{{date "Y-m-d"}}
{{date "F j, Y"}}
{{date "M j"}}
FearlessCMS supports modular templates, allowing you to break down templates into reusable components. This makes themes more maintainable and reduces code duplication.
Use the {{module=filename.html}}
syntax to include other template files:
html
{{module=header.html}}
{{module=footer.html}}
{{module=navigation.html}}
Use the {{include=filename.html}}
syntax to include files from the themes directory (not theme-specific):
html
{{include=ad-area.html}}
{{include=shared-components.html}}
{{include=common-ads.html}}
Note: The {{include=}}
syntax is different from {{module=}}
:
{{module=}}
looks for files in the current theme's templates directory{{include=}}
looks for files in the main themes directory (shared across all themes)#### Variable Access Modules have access to all template variables:
html
{{siteName}}
{{#if siteDescription}}
Fast and Fearless Content Managment
{{/if}}
#### Conditional Logic Modules support all template conditionals:
html
{{#if heroBanner}}
{{/if}}
#### Loops Modules support foreach loops:
html
#### Nested Modules Modules can include other modules:
html
{{siteName}}
{{module=navigation.html}}
You can include modules with or without the .html
extension:
html
{{module=header.html}}
{{module=header}}
If a module file is not found, the system will log an error and insert a comment:
html
Main template (page.html):
html
{{module=head.html}}
{{module=header.html}}
{{module=hero-banner.html}}
{{module=sidebar.html}}
{{module=footer.html}}
Head module (head.html):
html
{{title}} - {{siteName}}
Header module (header.html):
html
{{siteName}}
Footer module (footer.html):
html
site-header.html
not h.html
)head.html
- HTML head section (meta tags, CSS, JS)header.html
- Site header (logo, navigation)footer.html
- Site footer (copyright, links)navigation.html
- Navigation menussidebar.html
- Sidebar content and layouthero-banner.html
- Hero banner sectionscontent-layout.html
- Content area layoutsFor more detailed information about modular templates, see the Modular Templates Guide.
Breadcrumbs provide users with navigation context and help them understand their current location within your site. FearlessCMS provides several variables to help you implement effective breadcrumb navigation.
html
html
Light Mode CSS:
css
.breadcrumb {
background: #f8f9fa;
padding: 0.75rem 1rem;
border-radius: 6px;
margin-bottom: 2rem;
font-size: 0.9rem;
color: #333;
}
.breadcrumb a {
color: #007bff;
text-decoration: none;
transition: color 0.2s;
}
.breadcrumb a:hover {
color: #0056b3;
text-decoration: underline;
}
.breadcrumb .current-page {
color: #6c757d;
font-weight: 500;
}
.breadcrumb > * + * {
margin-left: 0.5rem;
}
Dark Mode Support:
css
@media (prefers-color-scheme: dark) {
.breadcrumb {
background: #2d2d2d !important;
color: #e0e0e0 !important;
}
.breadcrumb a {
color: #007bff !important;
}
.breadcrumb a:hover {
color: #4da6ff !important;
}
.breadcrumb .current-page {
color: #b0b0b0 !important;
}
}
aria-label="Breadcrumb"
for screen readers>
or /
between levelsFor complex sites with multiple levels, you can create dynamic breadcrumbs:
html
This requires setting up a breadcrumbPath
variable in your content or template data.
html
{{siteName}}
{{#if themeOptions.logo}}
{{else}}
{{siteName}}
{{/if}}
{{#if siteDescription}}
Fast and Fearless Content Managment
{{/if}}
{{#if menu.main}}
{{/if}}
{{content}}
{{#if children}}
Related Pages
{{#each children}}
{{title}}
{{#if excerpt}}
{{excerpt}}
{{/if}}
{{/each}}
{{/if}}
html
{{title}} - {{siteName}}
{{title}}
html
Page Not Found - {{siteName}}
html
{{#if themeOptions.showSidebar}}
{{/if}}
html
html
{{title}}
{{debug}}
to output all available variables