Skip to content

Commit

Permalink
use rewrite instead of redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
zoheb391 committed Sep 21, 2023
1 parent 6274314 commit 07a35ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
15 changes: 12 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ const withNextra = require("nextra")({
latex: true,
});

const { withPlausibleProxy } = require("next-plausible");

module.exports = {
...withNextra(),
...withPlausibleProxy(),
async redirects() {
return [
{
Expand All @@ -33,4 +30,16 @@ module.exports = {
},
];
},
async rewrites() {
return [
{
source: "/js/script.js",
destination: "https://plausible.io/js/script.js",
},
{
source: "/api/event",
destination: "https://plausible.io/api/event",
},
];
},
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"dependencies": {
"classnames": "2.3.2",
"next": "^13.5.1",
"next-plausible": "^3.11.1",
"nextra": "latest",
"nextra-theme-docs": "latest",
"react": "^18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PlausibleProvider from "next-plausible";
import "../styles/globals.css";
import Script from "next/script";

export default function MyApp({ Component, pageProps }) {
return (
<PlausibleProvider domain="docs.chainflip.io">
<>
<Component {...pageProps} />;
<Script defer data-domain="docs.chainflip.io" src="/js/script.js" />
<Script
async
src="https://www.googletagmanager.com/gtag/js?id=G-VS19KR3TSL"
Expand All @@ -16,6 +16,6 @@ export default function MyApp({ Component, pageProps }) {
"window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-VS19KR3TSL');",
}}
></Script>
</PlausibleProvider>
</>
);
}
15 changes: 0 additions & 15 deletions pnpm-lock.yaml

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

0 comments on commit 07a35ef

Please sign in to comment.