diff --git a/website/next.config.js b/website/next.config.js index abdb3c62f..7d95306a6 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -1,3 +1,5 @@ +const { withPlausibleProxy } = require('next-plausible') + const withNextra = require('nextra')({ theme: 'nextra-theme-docs', themeConfig: './theme.config.jsx', @@ -6,7 +8,7 @@ const withNextra = require('nextra')({ defaultShowCopyCode: true, }) -module.exports = withNextra({ +module.exports = withNextra(withPlausibleProxy()({ // Redirect old .html links async redirects() { const { redirects } = require('./redirects'); @@ -28,7 +30,7 @@ module.exports = withNextra({ ...redirectList, ] }, -}) +})); // If you have other Next.js configurations, you can pass them as the parameter: // module.exports = withNextra({ /* other next.js config */ }) diff --git a/website/package-lock.json b/website/package-lock.json index 2ba32ae9d..35e728764 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -9,6 +9,7 @@ "@heroicons/react": "^2.0.18", "@octokit/graphql": "^7.0.1", "next": "^13.4.9", + "next-plausible": "^3.11.1", "next-seo": "^6.1.0", "nextra": "^2.8.0", "nextra-theme-docs": "^2.8.0", @@ -4989,6 +4990,19 @@ "react-dom": ">=16.x <=18.x" } }, + "node_modules/next-plausible": { + "version": "3.11.1", + "resolved": "https://registry.npmjs.org/next-plausible/-/next-plausible-3.11.1.tgz", + "integrity": "sha512-Gd+QU+XflVTx65yJ2cNZyrOQLrpz3uKjGLEG4ls+CIVqK3yjsVGCMsEWJcvv1LAeVfHUQtCyp1xyAltLn5Odcg==", + "funding": { + "url": "https://github.com/4lejandrito/next-plausible?sponsor=1" + }, + "peerDependencies": { + "next": "^11.1.0 || ^12.0.0 || ^13.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/next-seo": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/next-seo/-/next-seo-6.1.0.tgz", diff --git a/website/package.json b/website/package.json index a85050b71..07df02244 100644 --- a/website/package.json +++ b/website/package.json @@ -10,6 +10,7 @@ "@heroicons/react": "^2.0.18", "@octokit/graphql": "^7.0.1", "next": "^13.4.9", + "next-plausible": "^3.11.1", "next-seo": "^6.1.0", "nextra": "^2.8.0", "nextra-theme-docs": "^2.8.0", diff --git a/website/src/pages/404.mdx b/website/src/pages/404.mdx index 6b0fef86f..6c0a22146 100644 --- a/website/src/pages/404.mdx +++ b/website/src/pages/404.mdx @@ -1,60 +1,75 @@ -import { ChevronRightIcon } from '@heroicons/react/20/solid' -import { BookOpenIcon, BugAntIcon } from '@heroicons/react/24/solid' +import { ChevronRightIcon } from '@heroicons/react/20/solid'; +import { BookOpenIcon, BugAntIcon } from '@heroicons/react/24/solid'; +import { usePlausible } from 'next-plausible'; +import { useEffect } from 'react'; -
-
-
404
-

This page does not exist

-
- Sorry, we couldn’t find the page you’re looking for. +export default function NotFound() { + const plausible = usePlausible(); + useEffect(() => { + // Track 404s so we can fix them + plausible('404', { props: { path: document.location.pathname } }); + }, []); + + return
+
+
404
+

This page does not + exist

+
+ Sorry, we couldn’t find the page you’re looking for. +
-
-
-

Popular pages

- +
+ + + Back to the home page + +
-
-
+ +} diff --git a/website/src/pages/_app.jsx b/website/src/pages/_app.jsx index 12ba341c4..4a4e8b193 100644 --- a/website/src/pages/_app.jsx +++ b/website/src/pages/_app.jsx @@ -1,6 +1,7 @@ import '../../styles/main.css'; import { useRouter } from 'next/router'; import { useEffect } from 'react'; +import PlausibleProvider from 'next-plausible'; const redirects = require('../../redirects').redirects; export default function MyApp({ Component, pageProps }) { @@ -24,5 +25,9 @@ export default function MyApp({ Component, pageProps }) { } }, []); - return + return ( + + + + ) }