Preconnect to Nitro client URL for faster client page load
This commit is contained in:
1 parent
da505ae643
commit
cfb36e8007
1 file changed
+4
@@ -62,6 +62,7 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
|||||||
const headersList = await headers();
|
const headersList = await headers();
|
||||||
const pathname = headersList.get("x-pathname") || headersList.get("next-url") || "";
|
const pathname = headersList.get("x-pathname") || headersList.get("next-url") || "";
|
||||||
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
||||||
|
const nitroUrl = await siteSettings.get("nitro_client_url", "");
|
||||||
return (
|
return (
|
||||||
<html lang={locale} className={`app ${nunito.variable} ${pixelFont.variable}`}>
|
<html lang={locale} className={`app ${nunito.variable} ${pixelFont.variable}`}>
|
||||||
<head>
|
<head>
|
||||||
@@ -69,6 +70,9 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
|||||||
<script src="/scripts/theme-init.js" />
|
<script src="/scripts/theme-init.js" />
|
||||||
<link rel="preconnect" href="https://www.habbo.com" />
|
<link rel="preconnect" href="https://www.habbo.com" />
|
||||||
<link rel="dns-prefetch" href="https://www.habbo.com" />
|
<link rel="dns-prefetch" href="https://www.habbo.com" />
|
||||||
|
{nitroUrl ? (
|
||||||
|
<link rel="preconnect" href={new URL(nitroUrl).origin} />
|
||||||
|
) : null}
|
||||||
</head>
|
</head>
|
||||||
<body
|
<body
|
||||||
className="flex min-h-screen flex-col site-bg"
|
className="flex min-h-screen flex-col site-bg"
|
||||||
|
|||||||
Reference in new issue
Block a user