Skip to content
Discussion options

You must be logged in to vote

What you need is to move the layout out of root to a pathless layout route, see https://remix.run/docs/en/v1/api/conventions#pathless-layout-routes.

That way routes inside the pathless layout route will have the sidebar and routes outside will not have it, the final file structure may look something like this

app
|-- root.tsx          <- here you keep only what you need on absolutely every route (e.g. html, head, body, etc.)
|__ routes
    |__ __sidebar
        |-- index.tsx <- this will render inside the Outlet of __sidebar.tsx
    |-- __sidebar.tsx <- here you render the sidebar
    |__ login.tsx     <- this will render outisde the __sidebar layout route

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Silvertassen
Comment options

Answer selected by Silvertassen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants