From 8c75c3d148365517d506c766722670db1a9557cd Mon Sep 17 00:00:00 2001 From: "Jandir A. Cutabiala" Date: Sun, 15 Sep 2024 11:43:37 -0300 Subject: [PATCH] feat: preload local font --- gatsby-ssr.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gatsby-ssr.ts diff --git a/gatsby-ssr.ts b/gatsby-ssr.ts new file mode 100644 index 0000000..ca96cf6 --- /dev/null +++ b/gatsby-ssr.ts @@ -0,0 +1,17 @@ +import * as React from "react"; +import { GatsbySSR } from "gatsby"; + +export const onRenderBody: GatsbySSR["onRenderBody"] = ({ + setHeadComponents, +}) => { + setHeadComponents([ + React.createElement("link", { + key: "kally-dreams", + rel: "preload", + href: "/fonts/Kally_dreams.otf", + as: "font", + type: "font/otf", + crossOrigin: "anonymous", + }), + ]); +};