Uh oh!
There was an error while loading. Please reload this page.
fix(schema): cleanup meta tags and deduplicate charset/viewport - #6378
Conversation
✅ Deploy Preview for nuxt3-docs canceled.
|
| viewport: 'width=device-width, initial-scale=1', | ||
| const resolved = defu(val, get('meta'), { | ||
| charset: val?.meta?.find(m => m.charset)?.charset ?? 'utf-8', | ||
| viewport: val?.meta?.find(m => m.name === 'viewport')?.content ?? 'width=device-width, initial-scale=1', |
There was a problem hiding this comment.
This logic could be simpler if we resolver after applying defu to conditionally set default viewport/charset.
There was a problem hiding this comment.
I guess I want to distinguish between which is source of truth. So if head.charset is resolved to utf-8 - was that because user set it or because that was the default value?
There was a problem hiding this comment.
Hmmm, we can add 3rd arg to defu too for real defaults. Not sure which syntax is more readable. One liner looks little bit unreadable. But we also have a find to filter below. It could be used to handle both filter and defaults for each.
Uh oh!
There was an error while loading. Please reload this page.
🔗 Linked issue
resolvesnuxt/nuxt#14477, resolvesnuxt/nuxt#13758
❓ Type of change
📚 Description
This sanitises user input for meta config, including preventing duplicate viewport + charsets (via meta and also top-level setting). It also removes a bit of code that was previously added for Bridge support, which didn't have access to schema.
📝 Checklist