- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system) - CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving - Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout - Content manager guide: layout selection from theme.json, plugin order in frontmatter - Both NL and EN updated with identical structure - 35 files updated
73 lines
1.5 KiB
Markdown
73 lines
1.5 KiB
Markdown
# Layouts
|
|
|
|
Layouts define the page structure (left sidebar, full width, etc.). Layouts are defined in `theme.json` and chosen via frontmatter in content files.
|
|
|
|
## Choosing a layout in content
|
|
|
|
```markdown
|
|
---
|
|
layout: left_sidebar
|
|
---
|
|
|
|
# Page title
|
|
|
|
Content...
|
|
```
|
|
|
|
## Layouts in theme.json
|
|
|
|
Layouts are defined in the `template` mapping. The `config.default_template` is the fallback for pages without a `layout:` frontmatter or with an unknown layout:
|
|
|
|
```json
|
|
{
|
|
"config": {
|
|
"default_template": "full_content"
|
|
},
|
|
"template": {
|
|
"full_content": "full_content.twig",
|
|
"left_sidebar": "left_sidebar.twig",
|
|
"right_sidebar": "right_sidebar.twig",
|
|
"custom1": "custom1.twig",
|
|
"guide": "guide.twig"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Layout template
|
|
|
|
A layout template extends `base.twig` and fills the `content` block:
|
|
|
|
```twig
|
|
{% extends 'base.twig' %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
{{ content|raw }}
|
|
</div>
|
|
{% endblock %}
|
|
```
|
|
|
|
## Layouts with sidebar
|
|
|
|
Layouts with a sidebar can show plugin content:
|
|
|
|
```twig
|
|
{% extends 'base.twig' %}
|
|
|
|
{% block content %}
|
|
<div class="row">
|
|
<main class="col-md-8">
|
|
{{ content|raw }}
|
|
</main>
|
|
<aside class="col-md-4">
|
|
{{ sidebar_content|raw }}
|
|
</aside>
|
|
</div>
|
|
{% endblock %}
|
|
```
|
|
|
|
If a page has no plugins or the layout has no sidebar, `sidebar_content` is empty.
|
|
|
|
## Guide layout
|
|
|
|
The `guide` layout (`guide.twig`) is special for guides. It injects the Navigation plugin into the sidebar for sidebar navigation. Automatically used for pages in the `guide/` folder. |