How to have tags in <head> in <StartServer> render using async loaded data?
I am trying to setup lots of meta tags (eg. for Facebook Open Graph) and also page Schema (which is a <script> tag).
Some of the data in there needs to depend on async loaded data.
But I can't even get createResource to work inside StartServer (just having a createResource in it results in a hydration error).
Also I need it to work with SSR for SEO.
The
@solidjs/meta
package is way inadequate for this.
What kind of approach can I use?1 Reply
Wait, looks like I found the solution! Here it is in case anyone finds this:
entry-server.tsx
:
By parsing the context.request.url
, we can then put in the correct meta tags and whatever other tags needed depending on the page without having to use @solidjs/meta
Of course the meta tags probably won't update on client side navigation, but this should be OK for SEO stuff.