Meta head management with title template?
Any good solutions for this? Similar to the title template that React Helmet or Next SEO provides?
titleTemplate="MySite.com - %s"
6 Replies
solid-meta should be able to do what you want https://docs.solidjs.com/solid-meta/getting-started/installation-and-setup
Thanks, I checked this out but I couldn't find anything about what I'm looking for:
For instance on the root layout:
titleTemplate="MySite.com - %s"
- Then on About: title="About"
and my head would automatically become:
MySite.com - About
- Another, on Login: title="Login"
and my head would automatically become: MySite.com - Login
---
Even NextJS has this in their metadata API: https://nextjs.org/docs/app/api-reference/functions/generate-metadata#template
Functions: generateMetadata | Next.js
Learn how to add Metadata to your Next.js application for improved search engine optimization (SEO) and web shareability.
yea nextjs is a fair bit higher level than solid start, you could build something like this yourself though
i'd do it by making a context that keeps track of the nested title, a custom
Title
component that sets the current value of the nested title in the context, and thenfurther up insert the nested title into the solid-meta <Title>
Thanks Brendon! I'll look into it a bit more.