Pages have a header, but with different imgs and possibly with content. Should I put this on layout?
Unanswered
Tomistoma posted this in #help-forum
TomistomaOP
Hi there! All my pages have an image at the top part. The image is different for each page. Only the home page has 100vh height. The others have 50vh. Some pages have some text on that image (e.g., the home page has some welcome; an article has title, author, etc). I wanted to use layout.tsx to have the image and this (possible) content because of partial rendering, which achievable with layouts.
In my app, I have i18n, so my app starts with [lang] folder. My layout.tsx has generateStaticParams because of that and I think I could use it to generate all my other routes (e.g., '/en/products', '/en/articles') and pass that to some components I could put on layout.tsx. For example, an image component could receive the route and choose one of the images on /public/imgs/ (statically imported) based on that. A heading component could check if that route should have some text on the image and get the content through the language dictionaries.
For some reason, the idea above doesn't feel right or good code. What is your opinion about this? Why should I do or shouldn't do like that? Which is the recommended way?
Thank you!
In my app, I have i18n, so my app starts with [lang] folder. My layout.tsx has generateStaticParams because of that and I think I could use it to generate all my other routes (e.g., '/en/products', '/en/articles') and pass that to some components I could put on layout.tsx. For example, an image component could receive the route and choose one of the images on /public/imgs/ (statically imported) based on that. A heading component could check if that route should have some text on the image and get the content through the language dictionaries.
For some reason, the idea above doesn't feel right or good code. What is your opinion about this? Why should I do or shouldn't do like that? Which is the recommended way?
Thank you!