Default SEO vs Route SEO
Hi everyone
I'm facing an issue where my DEFAULT SEO overrides the ROUTE SEO.
I created two components (on the thread):
- the
default.tsx
where I import on app.tsx
;
- the page.tsx
where I import on each route.
But, when I see the meta tags, they are from the default.tsx
instead of the page.tsx
.
Any way to keep the default and override it on the routes?3 Replies
And the usage:
app.tsx
routes/projects/[slug.tsx]
Any suggestion?
I change everything to PageSeo
and use it with the title
as optionalI experienced what I think was a similar issue but kicked the can down the road, iirc it seemed like
<Title>
would override correctly but the other meta tags wouldn't (my memory could be failing me though). I thought about a solution like wrapping the Router in a context provider, and having a custom Meta wrapper component with a "default" boolean or "priority" integer prop which configures which meta component overrides which, then some whacky state setting in that context when the wrapper mounts (with onCleanup to reset it) so only the non-default/highest priority wrapped Meta children get rendered.
If you end up implenting some solution, I'd definitely appreciate it if you shared it, I'll do the same if I get around to that firstI start using only one component and need to put it in every page, didn’t found a better solution 😦
Hi everyone
I'm facing a strange issue
I'm using the component
PageSeo
everywhere, but isn't working
The seo is from the previous page unitl I refresh the page