-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add FontPreload * add FontPreload to Skeleton
- Loading branch information
1 parent
f8d78ed
commit b7f73e2
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/components/src/templates/next/components/internal/FontPreload.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// The following links are included to improve SEO and Lighthouse performance by optimizing font loading. | ||
// Preconnecting to fonts.gstatic.com allows the browser to establish a connection early, reducing latency | ||
// when fetching fonts, which can lead to faster rendering and improved user experience. | ||
|
||
export const FontPreload = () => { | ||
return ( | ||
<> | ||
<link | ||
// Establish an early connection to fonts.gstatic.com | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
crossOrigin="anonymous" // required when making requests to a different origin | ||
/> | ||
<link | ||
// Serve as a fallback for browsers that don't support preconnect | ||
// at least allowing early DNS resolution | ||
rel="dns-prefetch" | ||
href="https://fonts.gstatic.com" | ||
/> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters