T
TanStack4mo ago
helpful-purple

Head Script not rendering

I am trying to insert a HEAD script for SEO purposes.
script: [
{
type: "application/ld+json",
children: JSON.stringify({
"@context": "http://schema.org",
"@type": "CreativeWork",
"@id": url,
name: title,
}),
}
],
script: [
{
type: "application/ld+json",
children: JSON.stringify({
"@context": "http://schema.org",
"@type": "CreativeWork",
"@id": url,
name: title,
}),
}
],
However, nothing appears in the SSR page source, nor in the chrome dev tools for the page
11 Replies
helpful-purple
helpful-purpleOP4mo ago
I even tried: https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management#managing-body-scripts
script: [
{
children: 'console.log("Hello, world!")',
},
]
script: [
{
children: 'console.log("Hello, world!")',
},
]
also not working
Document Head Management | TanStack Router React Docs
Document head management is the process of managing the head, title, meta, link, and script tags of a document and TanStack Router provides a robust way to manage the document head for full-stack appl...
exotic-emerald
exotic-emerald4mo ago
can you share your root file?
helpful-purple
helpful-purpleOP4mo ago
OMG!!! In my file i had script: [ ... ] instead of scripts: [] !!!!! Problem solved
exotic-emerald
exotic-emerald4mo ago
Happy to be the rubber ducky! haha
No description
like-gold
like-gold4mo ago
should that not have triggered a typescript error?
exotic-emerald
exotic-emerald4mo ago
@Manuel Schiller I don't think we omitting the index signature for some reason I'm taking a look at
exotic-emerald
exotic-emerald4mo ago
Ok so I tried messing with the types and I can't figure it out best I can do for now is this (I looked into things like type-fest & super deep dive into stackoverflow) => https://github.com/TanStack/router/pull/4241 I also provided that vite doesn't enforce when using a function so probably a known TS thing though I can't seem to find it
GitHub
fix(router-core, start-client-core): Additional types to help with ...
This is an attempt to provide some feedback to the developer if they provide unexpected keys to the head property. source: https://discord.com/channels/719702312431386674/1372533009563258880 FYI if...
like-gold
like-gold4mo ago
why is this necessary? it already errors
like-gold
like-gold4mo ago
No description
No description
like-gold
like-gold4mo ago
ah but it does not error if one valid element is there
like-gold
like-gold4mo ago
No description

Did you find this page helpful?