fix(docs): give next-plausible 4 the script 3 rendered for the domain

next-plausible went from 3 to 4, which takes the script's URL instead of a
domain and throws "src is required when not using withPlausibleProxy" when
it has none. The docs layout passed `domain`, so every docs page threw on
render.

3 rendered Plausible's shared script, https://plausible.io/js/script.js,
with data-domain set to the domain. The layout now hands 4 that URL and that
attribute. What differs is 4's own inline stub, which also defines
plausible.init() and calls it, and `async` without 3's `defer`.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-09-19 04:52:33 -07:00
co-authored by Hanzo Dev
parent f4d11ce96f
commit bcabc44303
+9 -1
View File
@@ -1,3 +1,5 @@
import type { ComponentProps } from 'react';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
@@ -6,6 +8,12 @@ import PlausibleProvider from 'next-plausible';
import './global.css';
// next-plausible 4 takes a script URL instead of a domain. This is the script 3
// rendered for `domain`: Plausible's shared script, told the site by data-domain.
const plausibleScript: ComponentProps<'script'> & { 'data-domain': string } = {
'data-domain': 'esign.hanzo.ai',
};
const inter = Inter({
subsets: ['latin'],
});
@@ -32,7 +40,7 @@ export default function Layout({ children }: LayoutProps<'/'>) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body className="flex min-h-screen flex-col">
<PlausibleProvider domain="esign.hanzo.ai">
<PlausibleProvider src="https://plausible.io/js/script.js" scriptProps={plausibleScript}>
<RootProvider>{children}</RootProvider>
</PlausibleProvider>
</body>