René's URL Explorer Experiment


Title: fix: preload LCP fonts instead of the wrong hero image · Issue #550 · ycode/ycode · GitHub

Open Graph Title: fix: preload LCP fonts instead of the wrong hero image · Issue #550 · ycode/ycode

X Title: fix: preload LCP fonts instead of the wrong hero image · Issue #550 · ycode/ycode

Description: Summary On the client website both mobile Lighthouse runs (14 Sep 2026) named the H1 “Your AI Co-Host for Streams & Communities” as the LCP element, with LCP between 3.9 s and 11.4 s. The headline is in the SSR HTML — it is not injected ...

Open Graph Description: Summary On the client website both mobile Lighthouse runs (14 Sep 2026) named the H1 “Your AI Co-Host for Streams & Communities” as the LCP element, with LCP between 3.9 s and 11.4 s. The headline ...

X Description: Summary On the client website both mobile Lighthouse runs (14 Sep 2026) named the H1 “Your AI Co-Host for Streams & Communities” as the LCP element, with LCP between 3.9 s and 11.4 s. The headl...

Opengraph URL: https://github.com/ycode/ycode/issues/550

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix: preload LCP fonts instead of the wrong hero image","articleBody":"## Summary\n\nOn the client website both mobile Lighthouse runs (14 Sep 2026) named the H1 **“Your AI Co-Host for Streams & Communities”** as the LCP element, with LCP between **3.9 s and 11.4 s**.\n\nThe headline **is in the SSR HTML** — it is not injected after hydration, and GSAP initial CSS does **not** hide it (`data-gsap-hidden` is used for mobile nav / other layers, not this H1). The delay is from **font loading + competing network/CPU**, not from animation initialisation of that heading.\n\nReports: PageSpeed Insights runs shared by the client (links kept out of the tracker).\n\nRelated platform JS cost: #548, #549.\n\n## What we found\n\n### 1. Wrong LCP candidate (high-priority image steal)\n\n`findLcpCandidate()` in `lib/asset-utils.ts` only considers **images**. On this homepage it picks a 40×40 social-proof avatar (`narianazone.webp`) because:\n\n- it is the first non-header/nav `image` layer\n- the layer’s `width`/`height` attributes are **300** (asset intrinsic), even though CSS renders it at 40px\n- `minWidth` is 200, so 300 passes\n\n`PageRenderer` then emits:\n\n```html\n\u003clink rel=\"preload\" as=\"image\" … fetchPriority=\"high\">\n```\n\nand the `\u003cimg>` gets `loading=\"eager\"` + `fetchPriority=\"high\"`.\n\nThat competes with the **actual** LCP (text) and with the Google Font files. The heuristic never considers a large H1 as LCP.\n\n### 2. LCP webfont is not preloaded\n\nThe H1 uses **Plus Jakarta Sans** 700 at 60px / 48px / 36px (`font-display: swap`). We already:\n\n- inline `@font-face` CSS (skip `fonts.googleapis.com`)\n- `preconnect` `fonts.gstatic.com` (response `Link` header + `\u003clink>`)\n- preload **uploaded custom** font files\n\nWe do **not** preload the latin woff2 for Google families. Custom-font preload was added in `198daea9`; Google fonts were left as CSS-discovered. Until Plus Jakarta Sans arrives, LCP for that H1 is delayed (swap) or painted with a fallback then updated.\n\nThe site also inlines **66 `@font-face` rules** (Inter + Plus Jakarta Sans, including italic + many unicode-range subsets). Inter italic is requested because `buildGoogleFontUrl()` adds the full italic axis whenever the installed font’s variants include italic — even if the page barely uses italic.\n\n### 3. Runtime / animation\n\n- `AnimationInitializer` (GSAP + ScrollTrigger + SplitText, ~136 KB / ≈51 KiB gzip) **does** load because the page has interactions. That is correct gating; it is not what hides the H1.\n- Hydrating `LayerRendererPublic` plus the duplicate chunks in #548 is the main **TBT** (650–730 ms) contributor alongside third-party tags (GTM; customer is reviewing tracking separately).\n- Background video (`cloth-optimised-1080p30.mp4`) is in the hero; the customer already cut homepage download ~7.3 → 4.4 MiB. Remaining video still contends for bandwidth on mobile.\n\n## Proposed fix\n\n- Extend LCP selection beyond “first large image”:\n  - skip images whose **rendered** size is tiny (avatar/logo), not just SVG / header/nav\n  - if the largest above-the-fold element is text (hero H1), do **not** `fetchpriority=high` a competing image\n- Preload the latin (and used-weight) woff2 for Google fonts that appear on likely LCP text, same as custom fonts.\n- Subset Google Font CSS to weights/styles actually used on the page (or at least skip italic when unused).\n- Optional: `font-display: optional` for non-LCP faces so the LCP face wins the connection.\n\n## Customer-facing settings (today)\n\nThere is **no** Ycode setting that preloads Google fonts or marks a layer as LCP. Until this ships, they can still:\n\n- Avoid on-load / scroll-into-view hide or SplitText on the hero headline (this page already does not hide it)\n- Keep third-party tags out of the hero path (they are reviewing this)\n- Keep the background video muted / `playsinline` and prefer a poster on mobile if they still see LCP contention\n- Not install unused italic/weight variants if we later subset by installed variants — today installing a family with italic still fetches the full italic axis\n\n## Test plan\n\n- [ ] Client website (or equivalent hero-text homepage): Lighthouse LCP element stays the H1, and no 40px avatar is preloaded with `fetchpriority=high`\n- [ ] HTML contains `\u003clink rel=\"preload\" as=\"font\">` for the H1’s latin woff2\n- [ ] A page whose LCP **is** a large hero image still gets image preload + eager\n- [ ] Pages without Google fonts do not emit extra preloads\n- [ ] Mobile LCP on a text-hero page moves toward the CrUX 2.4 s band rather than 4–11 s lab\n","author":{"url":"https://github.com/ysamcode","@type":"Person","name":"ysamcode"},"datePublished":"2026-09-15T05:44:37Z","url":"https://github.com/ycode/ycode/issues/550"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:193cd086-9d50-16f0-f48e-2e43ee08561c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id987E:56627:A5472:D6214:6AFE3326
html-safe-nonceb587c66567cd92435f5610f08a349c4a4dd2c200980f77997f2212adc7f658f8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODdFOjU2NjI3OkE1NDcyOkQ2MjE0OjZBRkUzMzI2IiwidmlzaXRvcl9pZCI6IjI0MjQ3NDcxMjc2MDQxMzA1OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf7fd49f20a2b5a19124aaddaea1612aaac93226134fd221e3da461d4326d76ab
hovercard-subject-tagissue:5458044061
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ycode/ycode/550/issue_layout
twitter:imagehttps://opengraph.githubassets.com/568f4edf9a973acc0b103403819468815f02b3bad70efdb0281d47ed29533827/ycode/ycode/issues/550
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/568f4edf9a973acc0b103403819468815f02b3bad70efdb0281d47ed29533827/ycode/ycode/issues/550
og:image:altSummary On the client website both mobile Lighthouse runs (14 Sep 2026) named the H1 “Your AI Co-Host for Streams & Communities” as the LCP element, with LCP between 3.9 s and 11.4 s. The headline ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameysamcode
hostnamegithub.com
expected-hostnamegithub.com
Noned70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2
turbo-cache-controlno-preview
go-importgithub.com/ycode/ycode git https://github.com/ycode/ycode.git
octolytics-dimension-user_id65892203
octolytics-dimension-user_loginycode
octolytics-dimension-repository_id1165452593
octolytics-dimension-repository_nwoycode/ycode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1165452593
octolytics-dimension-repository_network_root_nwoycode/ycode
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseccb88d9c92abe69245b429398c8a57ae87070c7c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/ycode/ycode/issues/550#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fissues%2F550
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fissues%2F550
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=ycode%2Fycode
Reloadhttps://github.com/ycode/ycode/issues/550
Reloadhttps://github.com/ycode/ycode/issues/550
Reloadhttps://github.com/ycode/ycode/issues/550
ycodehttps://github.com/ycode
ycodehttps://github.com/ycode/ycode
Codehttps://github.com/ycode/ycode
Issues7 (7)https://github.com/ycode/ycode/issues
Pull requests1 (1)https://github.com/ycode/ycode/pulls
Discussionshttps://github.com/ycode/ycode/discussions
Actionshttps://github.com/ycode/ycode/actions
Projectshttps://github.com/ycode/ycode/projects
Security and quality1 (1)https://github.com/ycode/ycode/security
Insightshttps://github.com/ycode/ycode/insights
https://github.com/ycode/ycode
New issuehttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/550
New issuehttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/550
fix: preload LCP fonts instead of the wrong hero imagehttps://github.com/ycode/ycode/issues/550#top
https://github.com/ysamcode
BugSomething isn't workinghttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Bug%22
https://github.com/ysamcode
ysamcodehttps://github.com/ysamcode
on Sep 15, 2026https://github.com/ycode/ycode/issues/550#issue-5458044061
#548https://github.com/ycode/ycode/issues/548
#549https://github.com/ycode/ycode/issues/549
fix: stop shipping duplicate JS chunks on published pages #548https://github.com/ycode/ycode/issues/548
ysamcodehttps://github.com/ysamcode
on Sep 15, 2026https://github.com/ycode/ycode/issues/550#event-31149806873
ysamcodehttps://github.com/ysamcode
BugSomething isn't workinghttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Bug%22
on Sep 15, 2026https://github.com/ycode/ycode/issues/550#event-31149807816
https://github.com/ysamcode
ysamcodehttps://github.com/ysamcode
on Sep 15, 2026https://github.com/ycode/ycode/issues/550#issuecomment-5675369624
#551https://github.com/ycode/ycode/issues/551
#548https://github.com/ycode/ycode/issues/548
#549https://github.com/ycode/ycode/issues/549
https://github.com/ysamcode
ysamcodehttps://github.com/ysamcode
on Sep 17, 2026https://github.com/ycode/ycode/issues/550#issuecomment-5714257867
fix: stop preloading small images as the page's LCP #559https://github.com/ycode/ycode/pull/559
feat: preload the heading font on published pages #560https://github.com/ycode/ycode/pull/560
ysamcodehttps://github.com/ysamcode
completedhttps://github.com/ycode/ycode/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 17, 2026https://github.com/ycode/ycode/issues/550#event-31318507968
jreschfreshhttps://github.com/jreschfresh
on Sep 17, 2026https://github.com/ycode/ycode/issues/550#event-31337861871
fix: skip tiny rendered images when picking the LCP preloadhttps://github.com/jreschfresh/ycode/commit/31305b620d5ae13a36580655d67012d8be76d9b2
31305b6https://github.com/jreschfresh/ycode/commit/31305b620d5ae13a36580655d67012d8be76d9b2
Sign up for freehttps://github.com/signup?return_to=https://github.com/ycode/ycode/issues/550
Sign in to commenthttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/550
ysamcodehttps://github.com/ysamcode
BugSomething isn't workinghttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.