cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

[Docs Site] Add link headers for 103 Early Hints

Open KianNH opened this issue 3 years ago • 5 comments

Example URL(s)

  • https://developers.cloudflare.com/

Actual Behavior

No link headers.

Expected Behavior

All the link headers.

Additional information

cc @kodster28 @WalshyDev

Now that we have Early Hints enabled on the docs site, we can leverage 103 Early Hints to make the site super fast 🔥

Preloads

In my opinion, this would include:

  • https://developers.cloudflare.com/home.css
  • https://developers.cloudflare.com/search.redirect.min.826764246c0056e88cd0af076274b8d9.js
  • https://developers.cloudflare.com/home.min.d720e27e667103421a4ba0e7d5a9c1bb.js

image

I haven't actually looked into what the JS does - or what any of the third party stuff does.

Since the JS is cache-busted with a hash, we'd need a post-build step to add them to the _headers file.

Preconnects

Important third party domains hosting assets:

  • www.googletagmanager.com

Suggestions

Happy to hear any thoughts about if anything needs adding or removing - obviously with preloads, we want to keep it to the critical render path otherwise you'll defeat the benefit of stuff like lazy loading or deferring.

KianNH avatar Jul 28 '22 20:07 KianNH

On another note, is the code block highlighting added through GTM? My fork doesn't have it and it looks ugly - but have never looked into why

KianNH avatar Jul 28 '22 20:07 KianNH

If you're talking what I think you're talking about, you can preview code block highlighting by running npm run prebuild prior to npm run dev (and then run npm run postbuild afterwards to strip out all the highlighting).

kodster28 avatar Jul 29 '22 13:07 kodster28

Also, in terms of Early Hints, heard that we might actually get the Smart Early Hints mentioned by the blog relatively soon, so the links might get added automatically.

kodster28 avatar Jul 29 '22 13:07 kodster28

you can preview code block highlighting by running npm run prebuild prior to npm run dev

image

Ooooooooooooooooooooooo - thanks.

we might actually get the Smart Early Hints mentioned by the blog relatively soon

That'll be pretty cool when it lands - I'd be interested to see how they select which assets to add as hints but I guess that'll be covered in another blog post when it becomes available.

KianNH avatar Jul 29 '22 13:07 KianNH

Yeah, and we'll be more than happy to provide feedback if it's not grabbing the right stuff, lol.

A requirement for working here is that you're pretty vocal (but friendly at the same time).

kodster28 avatar Jul 29 '22 13:07 kodster28

Addressed in the attached PR.

kodster28 avatar Oct 10 '22 15:10 kodster28