Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set a layout per taxonomy #6492

Closed
wants to merge 2 commits into from
Closed

Conversation

edalzell
Copy link
Contributor

Closes #2003

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it the same as Collection?

The layout method falls back to layout, and it's not necessary to set the fallback in TaxonomiesStore.

public function layout($layout = null)
{
return $this
->fluentlyGetOrSet('layout')
->getter(function ($layout) {
return $layout ?? 'layout';
})
->args(func_get_args());
}

->layout(array_get($data, 'layout'))

@jasonvarga
Copy link
Member

Actually, this is unfortunately inconsistent with collections.

On a collection, you can define template and layout in the yaml, which will set them for the entries.

On a taxonomy, the template method is what will be used for the automatically routed index url.
The layout method is what's used for that route too.

This PR is allowing you to adjust the layout for the automatically routed taxonomy page. Not the entries. The issue #2003 is about people wanting the term layouts to be customizable.

This is another thing that would be resolved if we scrapped the automatic routing as per statamic/ideas#839

@jasonvarga jasonvarga closed this Aug 15, 2022
@edalzell edalzell deleted the feature/taxonomy-layout branch August 15, 2022 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't set a custom layout or template for a taxonomy
2 participants