We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
This feature provides a structured layout system for your Phoenix application, replacing the default single layout with purpose-built layouts for different page types. It automatically generates separate layouts for application pages, authentication flows, and public-facing content with consistent navigation and theming.
Key Benefits
Implementation Details
The feature creates three distinct layout modules:
Layouts.App
- Main application layout with full navigation for authenticated usersLayouts.Session
- Minimal layout for login/registration pages without navigationLayouts.Public
- Public-facing layout for marketing/landing pagesIt refactors the existing layouts.ex
to delegate to these specialized modules and updates all authentication LiveViews to use the appropriate session layout. The root layout is simplified by removing embedded navigation in favor of layout-specific implementations.
Usage Example
# In your LiveView
def render(assigns) do
~H"""
<Layouts.App.page flash={@flash} current_scope={@current_scope}>
<div class="space-y-6">
<!-- Your app content -->
</div>
</Layouts.App.page>
"""
end
# Session pages automatically use minimal layout
<Layouts.Session.page flash={@flash} current_scope={@current_scope}>
<!-- Login form without navigation -->
</Layouts.Session.page>
Configuration
No additional configuration required. The feature automatically updates existing authentication pages and provides reusable logo and avatar components. Theme toggle functionality is preserved across all layouts.