Repository navigation
Collapsing <head> Behavior? #15
Replies: 5 comments 6 replies
|
+1 to the overall concept. One potential pain point that Iβd like to see expanded upon would be what people have been experiencing in CSS: expected load order. People have different assumptions about the order in which CSS is collected when imported across multiple pages & components. Merging |
|
Overall, I was hoping that all |
|
I'm a big fan of how the general idea of something similar to One big question would be if priority is given based on a depth-first or breadth-first search. i.e. What's the title on this page? <body>
<div>
<div>
<head>
<title>Other title</title>
</head>
<div>
<div>
<head>
<title>Best title ever</title>
</head>
</body> |
|
RFC was merged |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@jonathantneal and I were chatting about #12 and discussing
<head>behavior & bugs in Astro, and how Svelte solves this via<svelte:head>. We came to the realization that only supporting<head>in your top-level pages (and not in components) doesn't make sense for anyone using a common layout component, which can act as a component but often defines the entire<head>. This is a very common use-case for Astro users, especially as we plan to lean more into common layouts as a way to do Astro themes: https://docs.astro.build/core-concepts/layouts/An idea that we came to was to just always collapse the
<head>values of any components in the tree into the final page<head>of the rendered HTML. This would solve for our layout use-case, and also give us more flexibleheadinjection inside of components at the same time.The main reasoning why this "magic" feels okay is that
<head>has no valid use-case (that we are aware of) inside a component template, since nesting a<head>inside of a<body>would be invalid.Is there buy-in for this idea, conceptually? I can flesh this out into a full RFC if so, but I wanted to do a quick temperature check before writing more.
Credit to @jonathantneal who (iirc) first proposed this in our convo!
All reactions