Replies: 6 comments
-
Its also important to note this component gets bundled and will require the browser to download its javascript so it can run in the browser which i guess is unavoidable but also unnecessary as the component should not be included or run on the client-side. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
I came to post here because im not sure yet how to solve this for myself, I just wanted to raise it because I know its something that exists for both of us. As you say it doesnt seem to have any issues as far as I can tell but the W3 Validator does flag it: I think we would have to change our current implementation of SEO from a component that sets the metadata to using load functions that return the metadata and it gets set in the main layout.svelte. Its hard to say if a different implementation will put the metadata above the script tags because there's no way to specify the importance of the svelte head you are setting. Let me check this and feedback. |
Beta Was this translation helpful? Give feedback.
-
After trying what is recommended in the svelte documentation, an ssr approach, it is clear the issue is with svelte not having the ability to specify where the svelte head contents go in the head tag. Even with this ssr approach, which i kind of prefer anyways (it still needs work), the head is jumbled and the meta tags are showing up underneath the script tags Here we setup Preview URL (to see metadata in action) |
Beta Was this translation helpful? Give feedback.
-
I raised an issue with svelte here: |
Beta Was this translation helpful? Give feedback.
-
I see, that's an interesting result. |
Beta Was this translation helpful? Give feedback.
-
Im not using your package however i have done pretty much the same thing - a component that you pass metadata info into and then it loads it into svelte head.
The issue I have noticed when using w3 validator is that the metadata component has no load time specificity or priority - this means that when rollup bundles the project it could load/run the metadata component last which can cause the metadata to show underneath the scripts and not be first in the head as recommended.
Which looks like this:
![image]()
W3 Validator is saying that it does not appreciate the meta tags being loaded in last and having all the scripts above it - whether or not this impacts anything im not sure but it is interesting to know.
The error W3 is giving me:
![image]()
Beta Was this translation helpful? Give feedback.
All reactions