Next.js Discord

Discord Forum

App Router: How to show one logo on the homepage and a different one on other pages

Answered
LaPerm posted this in #help-forum
Open in Discord
LaPermOP
How would I use only the root layout to detect if I'm on the homepage and show the company icon logo on that page (because the full logo is in the homepage banner) and then if I'm on any other page (it's a small site) show only the full company logo.

Since the root layout has to be a server component and usePathname hook can only be run on client components. Does this mean I have to have two layouts which are almost identical?
Answered by Ray
I would create two route group
app/(big-logo)/layout.tsx
app/(small-logo)/layout.tsx
View full answer

4 Replies