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
In addition to what @findlabnet has said, you possibly want to be looking at metatags as you can then tell search engines which page is the canonical source for a given page. In this scenario,...
xmlsitemap module generates wrong links for languages
Not only twice — the number of languages not excluded from the sitemap can be greater than that. This feature is designed according to the corresponding recommendations. So, I can't...
xmlsitemap module generates wrong links for languages
How do you prevent the home page for every language to be added to the sitemap twice with easy xml sitemap?
xmlsitemap module generates wrong links for languages