-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[✨] Add a scripts
key to head to allow for injecting custom scripts.
#2593
Comments
script
key to head to allow for injecting custom scripts.scripts
key to head to allow for injecting custom scripts.
At the end of the day, I think DevEx should take precedence here. While contexts can be used to bubble data up into |
This sounds like a use case for partytown https://qwik.builder.io/integrations/integration/partytown/ |
anybody want to take into a PR? |
Hi @manucorporat |
Hi @manucorporat 😄 I would like to work on this if possible. Thanks! |
@manucorporat which properties should we include in the |
@manucorporat Is there anything else expected to close this issue? |
* feat: adding Script Tag to Head Tag via DocumentHead Feat #2593 * refactor(fixes type import): fixes import type directly from package instead of absolute url * feat(qwik-city): fix head file * feat(qwik-city): fix styles in qwik-city-component * docs(qwik-city): update api * fix(qwik-city): fix export * fixup! feat(qwik-city): Adding Script Tag to Head Tag via DocumentHead * fixup! feat(qwik-city): Adding Script Tag to Head Tag via DocumentHead --------- Co-authored-by: Harkunwar Kochar <harkunwar@qwik> Co-authored-by: Miško Hevery <misko@hevery.com>
the feature is done. |
Is your feature request related to a problem?
I'm trying to add structured data to a statically generated blog but there doesn't seem to be a native way to inject
script
tags into the page'shead
.I believe you can only edit
head
withinroot.tsx
. Outside of that we have to export ahead
object which only expects three keys:frontmatter
,links
, andmeta
. It would nice to also include ascript
key as well (or perhaps aScript
component similar to what's in NextJS) to customize ad-hoc scripts.Describe the solution you'd like
We can allow
DocumentHead
to accept ascripts
key. The type of the key could be an array of objects. An example of this implementation can be:Where
script
accepts the script tag as a raw string andeagerness
can determine where the script should be placed on the page (either in the head or right before the closing body tag).Describe alternatives you've considered
I was considering using a
QwikContext
to store blog metadata and then consume this context up inroot.tsx
(essentially a bottom-up approach). Though I feel a solution like this shouldn't need to rely on context.Additional context
No response
The text was updated successfully, but these errors were encountered: