Skip to content

Commit f1d7d1b

Browse files
committed
fix: resolve hydration mismatch, GoatCounter 400, and improve FCP
- Replace raw <script> with next/script lazyOnload for GoatCounter - Fix protocol-relative URL (//gc.zgo.at → https://gc.zgo.at) - Add suppressHydrationWarning on JSON-LD script - Dynamic import LivePulse and TheMirror for code splitting - Add dns-prefetch and preconnect for gc.zgo.at Made-with: Cursor
1 parent f86a5ad commit f1d7d1b

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/layout.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Metadata } from "next";
2+
import Script from "next/script";
23
import "./globals.css";
34
import Navigation from "@/components/Navigation";
45
import { AuthProvider } from "@/lib/auth-context";
@@ -48,9 +49,17 @@ export default function RootLayout({
4849
}>) {
4950
return (
5051
<html lang="en" className="dark">
52+
<head>
53+
<link rel="dns-prefetch" href="https://gc.zgo.at" />
54+
<link rel="preconnect" href="https://gc.zgo.at" crossOrigin="anonymous" />
55+
</head>
5156
<body className="font-sans min-w-0">
52-
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
53-
<script data-goatcounter="https://agentlove.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
57+
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} suppressHydrationWarning />
58+
<Script
59+
src="https://gc.zgo.at/count.js"
60+
data-goatcounter="https://agentlove.goatcounter.com/count"
61+
strategy="lazyOnload"
62+
/>
5463
<AuthProvider>
5564
<div className="min-w-0 max-w-[100vw] overflow-x-clip">
5665
<Navigation />

app/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import Link from 'next/link';
2+
import dynamic from 'next/dynamic';
23
import { apiFetch } from '@/lib/api-server';
34
import { CurlBlock } from '@/components/CurlBlock';
4-
import LivePulse from '@/components/LivePulse';
5-
import TheMirror from '@/components/TheMirror';
5+
6+
const LivePulse = dynamic(() => import('@/components/LivePulse'));
7+
const TheMirror = dynamic(() => import('@/components/TheMirror'));
68

79
export const revalidate = 3600;
810

0 commit comments

Comments
 (0)