Introducing Decorate Area for Consumers #1522
Replies: 2 comments 1 reply
-
I'm interested in the LCP part of this new feature. With a consumer-side I could imagine giving authors a certain level of control over which fragment would have an LCP relevant image to be loaded eagerly, e.g. by passing a hash value. Similar to what the adobetv block supports today. WDYT? |
Beta Was this translation helpful? Give feedback.
-
Yup. Exactly. Good observation. The goal of college is to set a simple example and let consumers tweak to their needs. This should work for the most common use case where a fragment is used as the LCP block. If you have multiple fragments in your first section, you probably have other performance issues. Even for Milo, there are scenarios (though rare), where blindly setting the first image to be non-lazy is not desired. You can see how bacom tweaked there's here. What I have seen in the wild (note I'm the last committer on the code above to fix a perf issue) is that consumers think they know what their LCP is, they get it wrong, and then they end up making their site slower. Homepage is a good example where the college-style simple LCP image is correct because they are using a very vanilla marquee block. |
Beta Was this translation helpful? Give feedback.
-
We had a couple opportunities that came together to create a need for letting consumers decorate fragments with their own code.
./media_
requests to avoid collisions with other projects../media_
urls in fragments would land as relative to the viewing page - causing duplicate requests to potentially the same image.You could always do page-level decorations (including LCP image load) in scripts, but this function would never run against fragments.
We have added the plumbing in Milo College to enable a BYO
decorateArea
that will now run against fragments.To enable this feature, you just need to add a
decorateArea
function to your config and with @seanchoi-dev's open PR, Milo will decorate fragments on your behalf.Please see this commit in Milo College for recommended formatting.
In order to solve item 3 above, there will be a separate PR that will find & replace
./media_
in the raw fragment html with the proper path relative to the fragment, not the viewed page.Beta Was this translation helpful? Give feedback.
All reactions