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

[5.x] Add a config for specifying the default layout #11025

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Oct 29, 2024

This PR adds a new config statamic.routes.layout that allow the default layout to be changed to something other than layout. I've also set it to look for an .env variable (STATAMIC_FRONTEND_ROUTES_LAYOUT).

Our use is we have a site where the same codebase is shared across slightly different site versions and need to adapt the layout significantly per site - but other than that the codebase is the same.

If it helps make the case - Livewire allow the layout to be changed in a config.

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.

IMO if this setting exists it should also be used wherever we already use layouts too, like in a collection.

return $layout ?? 'layout';

@ryanmitchell
Copy link
Contributor Author

Cool. Time to grep ‘layout’.
Leave it with me

@jasonvarga
Copy link
Member

It's really just Collection@layout and Taxonomy@layout that have the string hardcoded. Change the config value and that should be good.

@ryanmitchell
Copy link
Contributor Author

Those are updated now.

@jasonvarga jasonvarga dismissed their stale review October 31, 2024 15:28

He did the thing

@jasonvarga
Copy link
Member

I moved the config into system.php where all sorts of misc settings go. I renamed the env var to STATAMIC_LAYOUT.
Having it in routes felt wrong since it doesn't just apply to routes.

@jasonvarga jasonvarga merged commit ce21344 into statamic:5.x Nov 1, 2024
16 checks passed
@ryanmitchell ryanmitchell deleted the feature/allow-default-layout-to-be-configured branch November 4, 2024 08:02
duncanmcclean added a commit to statamic/statamic that referenced this pull request Nov 12, 2024
duncanmcclean added a commit to statamic/statamic that referenced this pull request Nov 12, 2024
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.

2 participants