Conditional Rendering: Exclude children from rendering <footer> in the RootLayout
Answered
Laysan Albatross posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Laysan AlbatrossOP
How would you do that? I tried some things, but I'm out of ideas and I have the strong feeling, that it's easier than I think.
The problem is I can't iterate threw all children and get the file path or something, because the relationships base on routing.
The problem sounds sooo basic.. I want that every page has a footer, but not the ones under /app/(home).
I even tried shit like parallel routes, to be able to pass a footer property into the RootLayout.
SOS
The problem is I can't iterate threw all children and get the file path or something, because the relationships base on routing.
The problem sounds sooo basic.. I want that every page has a footer, but not the ones under /app/(home).
I even tried shit like parallel routes, to be able to pass a footer property into the RootLayout.
SOS
![Image](https://cdn.discordapp.com/attachments/1201536860120436757/1201536860321751132/ConditionalFooter.png?ex=65ca2d66&is=65b7b866&hm=eda92be60a28ee41e4683e6d5f63b7f91b43384f755a968eac8f25cdf7e96c0a&)
![Image](https://cdn.discordapp.com/attachments/1201536860120436757/1201536860606955550/NoFooterHere.png?ex=65ca2d67&is=65b7b867&hm=da3518a5ed78efa6a1705310324c1eddb3716ca248a6fc3360fa05785311b9b6&)
Answered by joulev
app/
layout.tsx <- do NOT put the footer here
page.tsx <- /
(with-footer)/
layout.tsx <- put the footer here
about/page.tsx, pricing/page.tsx, etc.
8 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Laysan AlbatrossOP
I mean, I could manually add the <footer> to each page, and ignore the one's where I dont want a footer, but that's 10/10 whack and surely not the best way of solving this issue
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
app/
layout.tsx <- do NOT put the footer here
page.tsx <- /
(with-footer)/
layout.tsx <- put the footer here
about/page.tsx, pricing/page.tsx, etc.
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Laysan AlbatrossOP
You mean put the whole layout except the footer in app/layout.tsx
And only add the footer to /app(with-footer)/layout.tsx
?
And only add the footer to /app(with-footer)/layout.tsx
?
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
yes
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Laysan AlbatrossOP
Like I said... I expected such an easy solution, fml, I spent a whole hour with that bs XD
Thank you so much man
Thank you so much man
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
lol yeah, sometimes our brain just fails to find a brutally simple solution
have fun coding
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Laysan AlbatrossOP
works!