Available Variables
ThemeService injects template variables into every view. This reference documents all variables available in each template.
Global Variables (All Templates)
| Variable | Type | Description |
|---|---|---|
site_name | string | Site name from settings |
site_tagline | string | Site tagline from settings |
page_title | string | Current page title |
current_url | string | Full current URL |
locale | string | Active locale code (e.g., en) |
cls | object | CSS class mapping from theme_info.json |
theme_options | object | Current theme option values |
lang_switcher | array | Available locales for language switcher |
home.tpl
posts— array of post objects (paginated)pager— CI4 Pager object (render via{! pager !})categories— array of category objects
post.tpl
post— full post objectcomments— array of comment objects (threaded)comment_count— integercategories,tags— arraysauthor_profile— author profile object (may be null)prev_post,next_post— adjacent post objects (may be null)seo_meta— SEO meta object (description, og_title, og_image)json_ld— JSON-LD structured data string
{% extends "layout.tpl" %}
{% block content %}
<article>
<h1>{{ post.title }}</h1>
{! render_content post !}
{% if author_profile %}{% include "partials/author-card.tpl" %}{% endif %}
{% include "partials/comments-list.tpl" %}
{% include "partials/comment-form.tpl" %}
</article>
{% endblock %}
page.tpl
page— static page object (id, title, slug, body, status)seo_meta— SEO meta object
category.tpl / tag.tpl
category/tag— taxonomy objectposts— paginated post objectspager— CI4 Pager object
archive.tpl
year,month— integersposts,pager
search.tpl
query— the search stringresults— matching post/page objectspager— CI4 Pager object
cls and theme_options
cls contains the full css_class_mapping object. theme_options contains resolved option values (merged defaults + admin config). Access via dot notation: {{ cls.cls_btn_primary }}, {{ theme_options.footer_copyright }}.