Next.js Discord

Discord Forum

Nextjs Root Layout

Unanswered
Shawty posted this in #help-forum
Open in Discord
it seems that the root layout is doing nothing:


code:
import '../pages/globals.css'
import type {Metadata} from 'next'
import {Inter} from 'next/font/google'
import Footer from "@/components/Footer";

const inter = Inter({subsets: ['latin']})

export const metadata: Metadata = {
    title: 'Moody',
    description: 'Elevate Your Discord Experience with Advanced Features',
}

export default function RootLayout({
                                       children,
                                   }: {
    children: React.ReactNode
}) {
    console.log("ok")
    return (
        <html lang="en">
        <body className={inter.className}>{children}</body>
        </html>
    )
}



im trying to add fonts and etc and nothing changes. i also deleted the file and no error or anything so i dont think the file is even getting detected.

file path:
src/app/layout.tsx

11 Replies

still no difference
@Shawty still no difference
reinstall modules then and then restart, also reload the browser few times
same thing
it works inside of _app.tsx tho?
but just not the body and html
European sprat
What is the name of this file?
layout.tsx
@Shawty layout.tsx
Ok i might be derping out here but to me it seems you are confusing page router and app router logic.
There is no such thing as a root layout in page router. You have to wrap your entire application with the layout component manually if you want to use something like a root layout. Also the layout wouldnt contain something like <html> tags. IIRC pages uses <Head> tag and stuff.
Btw im saying all this because you mentioned _app.tsx which isnt a thing in App Router.