Description of the need
Using a Layout for a specifig path requires one to define at least 2 Layouts, if views pages are used.
- one for the base path (https://site-name/base-path
)
- one for sub-paths (https://site-name/base-path/sub-paths
)
The reason: views are not nodes.
As example: https://my-site/flowers/roses/wildroses
This consists of a base-path (flowers), a sub-path (roses) and a tirtiary path (wildroses).
For the whole tree, the same layout should be used:
- https://my-site/flowers
(views-page)
- https://my-site/flowers/roses
- https://my-site/flowers/roses/wildroses
The base path (flowers) must be configured in the Path field, like:
- [https://site-name/] base-path
(flowers
)
The sub-paths (roses, roses/wildroses) have to be configured in the Path field too, but different, like:
- [https://site-name/] node/%
- Then a Visibility condition has to be added like: base-path/*
(flowers/*
)
The "Sub-Path" configuration does not work for the base path and vice versa.
For Sites with many layouts, the required effort is twice as much, as it could be.
If one adds classes for layouts to the pages, it complicates the things again. The CSS has to contain two class definitions for both, the base-path layout and the sub-paths layout.
Proposed solution
If the placeholder could be used alone as single element, without the need, to define a node. This should solve the problem. It could be used to define the base-path too.
- [https://site-name/] %
- Then a Visibility condition could be added like: base-path*
- A context entry for "path" would be required. (if no node is available)
Otherwise, if the path could be defined with wildcards in the Path field, like:
- [https://site-name/] base-path*
... like this is already used in visibility conditions ...
This would be the easiest solution.
Alternatives that have been considered
First I've tried the Layout Wildcard module, until I found out, this only can be used for multiple sub-paths or independent secondary paths, but not for any base-path.
Additional information
How to add classes for layouts to the pages HTML:
This can be done, modifying the themes template.php
, here a sub theme of the Basic theme.
function sub_basic_preprocess_page(&$variables) {
$layout = layout_get_layout_by_path();
if ($layout) {
$variables['classes'][] = 'layout-' . $layout->name;
}
}
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now simplyfies the configuration of Layouts.
Recent comments
Thank you, olafski I had already done that, but switching languages wasn't tied to whatever layouts were needed. I'll work with the other reply, see if I can replicate the...
How to translate my site content
Both issues solved! Thank you.
View/Edit tabs missing
Hello, Backdrop CMS has options for multilingual sites, but they are limited and do not cover all needs. A complete solution for a multilingual site requires the installation of i18. I...
How to translate my site content