cms
cms copied to clipboard
Can't set a custom layout or template for a taxonomy
Bug Description
Setting a custom layout or template in your taxonomy yaml config doesn't register.
It appears to always be looking for the default locations. In our case we have our default layout under views/layouts/default.antlers.html which works fine with collections but not with taxonomies.
How to Reproduce
Extra Detail
Environment
Statamic version: 3.0.0.-beta-33
Update: Turns out you can define these in the term.yaml itself, but not in the config yaml for the taxonomy... which to me seems a little odd? Is this likely to be fixed?
You could set layout/template in the blueprint via a hidden field so it always applies to all terms.
You could set layout/template in the blueprint via a hidden field so it always applies to all terms.
Are blueprints supposed to override the layout or template?
If no, is the above solution of a hidden field the best way to get that functionality?
If yes, I have a layout applied to a blueprint that is not being inherited by a page:
resources/blueprints/collections/pages/sidebar.yaml:
title: Sidebar
layout: layouts/sidebar
content/collections/pages/sidebar-example.md:
---
title: Sidebar
blueprint: sidebar
Neither the layout or template (if I set it) is not being picked up on the sidebar-example page. Is this related to the above taxonomy issue or should I create a separate issue?
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
I removed the stale label. It's still present and relating to: https://github.com/statamic/cms/issues/2403
Can this duplicate be removed?
They are separate issues. This one is about custom templates, the other is about routes.
Same issue here. I can confirm that setting the layout only work on the terms and not on the taxonomy. In fact the taxonomy YAML file seems to be oblivious to the whole "Cascade" thing.
Only current workaround for me:
- Add
layout: layouts/mainto all existing terms - Add a hidden blueprint text field to the taxonomy with
default: layouts/mainso it gets automatically added to newly created terms.
I've used the blueprint workaround to specify a custom layout for a term, but I can't see a way to customise the layout used for the index view. It defaults to layout - is there a way to change this?
+1 for this feature as well. Hitting the same wall as @stephenmeehanuk
Ran into this problem again this morning...
/blog/categories is my taxonomy index page. I can specify the correct layout for my terms, using a hidden field in the taxonomy blueprint.
But the index page is still defaults to resources/views/layout
Even though {{dump}} shows the correct layout?
#template: "blog/show"
#layout: "layouts/triple"
Statamic
Addons: 1
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 3.4.1 PRO
I'd like to be able to configure the layout for my taxonomy index page, is there a workaround?
This problem is still there in the latest version.
As a temporary fix, I'm using this in routes/web.php
Route::statamic('/blog/categories', 'blog/categories/index', [
'layout' => 'blog/layout'
]);
This is how I'm setting a layout for my category index page.