Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@docusaurus/faster": "3.10.2",
"@docusaurus/preset-classic": "3.10.2",
"@mdx-js/react": "^3.0.0",
"@vercel/analytics": "^2.0.1",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"prismjs": "^1.30.0",
Expand Down
38 changes: 37 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions src/theme/Root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type {ReactNode} from 'react';
import {Analytics} from '@vercel/analytics/react';

// Docusaurus has no built-in Root component of its own to extend — this
// file, once present under src/theme/, is picked up automatically and
// wraps the entire app. That makes it the right place to mount
// @vercel/analytics: it needs to render once, outside any page, and Root
// is the only place Docusaurus guarantees is common to every route
// (browser vs. server-rendered pages included).
//
// Vercel Web Analytics itself only reports anything once this site is
// deployed on Vercel with Analytics turned on for the project (Vercel
// dashboard → project → Analytics tab) — this component is inert
// (no requests, no error) in local dev and in any other hosting
// environment.
export default function Root({children}: {children: ReactNode}): ReactNode {
return (
<>
{children}
<Analytics />
</>
);
}
Loading