-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat(nuxt): enable renderSSRHeadOptions
configuration for unhead
#26989
feat(nuxt): enable renderSSRHeadOptions
configuration for unhead
#26989
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I'm wondering about the best location for this (and possibly other options) for the head - maybe instead in |
If a Having a way to pass options to the Unhead functions would be the most future proof and it would make sense for that config to exist within the head modules config that is under the export default defineNuxtConfig({
meta: {
renderSSRHead: { // typeof RenderSSRHeadOptions @unhead/schema
ssrOmitLineBreaks: true,
}
}
}) I don't really see a reason why this can't be enabled by default in a production environment for v4 either 🤔 Could also be the default of Unhead v2 if I have time to get to this before v4 |
I am currently following the conclusions of unjs/unhead#297 and have set Also, concerning the type of export default defineNuxtConfig({
meta: {
renderSSRHeadOptions: { // typeof RenderSSRHeadOptions @unhead/schema
omitLineBreaks: true,
}
}
}) Moreover, as we anticipate the name will change to |
I don't think either |
It appears that our decision to use Additionally, should we set the schema part in |
omitLineBreaks
configuration for @unhead
renderSSRHeadOptions
configuration for unhead
packages/schema/src/config/app.ts
Outdated
|
||
meta: { | ||
/** | ||
* An object that will be passed to `renderSSRHead` to customize the output. | ||
* | ||
* @see https://unhead.unjs.io/setup/ssr/installation#options | ||
* @type {typeof import('@unhead/schema').RenderSSRHeadOptions} | ||
*/ | ||
renderSSRHeadOptions: undefined, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments here will automatically generate documentation. I want to know how to write better?
I wonder about using |
I didn’t put much thought into the name initially, but now that I’ve thought it over, nuxt/packages/schema/src/config/app.ts Lines 108 to 110 in 572c367
Should we change it to |
I think likely, though I'd love feedback from @pi0 and @harlan-zw particularly. 🙏 The bit in schema is an (untyped) backwards-compatible bit. We'd likely need to keep the backwards-compatibility, but people really shouldn't be using it at this point. |
We've decided to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Though will wait for @harlan-zw's thoughts on API. 🙏
Looks good minus the comment. I'm guessing this will land in v3.12 so probably we want to minimise any new behaviour until v4. |
…gure-omitLineBreaks
🔗 Linked issue
omitLineBreaks
of@unhead
#26983📚 Description
This PR support configure
renderSSRHeadOptions
ofunhead
to help us adjust the output of head tags, such as get more compact HTML result.In production environment , when
meta.renderSSRHeadOptions.omitLineBreaks
isfalse
:In production environment , when
meta.renderSSRHeadOptions.omitLineBreaks
isundefined
ortrue
: