Next.js Discord

Discord Forum

New fresh/empty layout on new url route

Unanswered
Fire ant posted this in #help-forum
Open in Discord
Fire antOP
How to have an empty or fresh layout that doesnt override layout from /app/layout.tsx? I tried this on my route

/embed/layout.tsx

import React from 'react';

export default function EmbedLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return <>{children}</>;
}


But this doesn't work, it still render layout like nav and footer from my main page.

My page.tsx in /embed just hello world text

16 Replies

@joulev to scope a layout to only some pages and not all
Fire antOP
i tried /(embed)/layout.tsx as in docs and not work
other page is /(embed)/embed/page.tsx
Fire antOP
removed the top level layout and its working
now where should i put the error and not found page?
putting in /app/error and not-found gives unlimited reloading if enter wrong route like /notrealroute
@Fire ant putting in /app/error and not-found gives unlimited reloading if enter wrong route like /notrealroute
Can you clarify this? What is the content of the root not found file?
@joulev Can you clarify this? What is the content of the root not found file?
Fire antOP
i had to restart the server to get it working, now the problem is where should i put the not-found page?
i put in app root /app/not-found but it gives error no root layout found
i dont want the top layout files in app root, cause i use the grouped layout
and what about the error page? where it should be when using group layout?
This is my current app dir