fix: wrong places and wrong strategies

This commit is contained in:
rizaldy 2024-01-31 03:26:54 +07:00
parent 24a6e5d568
commit 9258f93846
2 changed files with 26 additions and 22 deletions

View File

@ -1,5 +1,7 @@
import "../styles/globals.css"; import "../styles/globals.css";
import Script from "next/script";
import { Fragment } from "react"; import { Fragment } from "react";
import Navbar from "../components/Navbar"; import Navbar from "../components/Navbar";
@ -13,7 +15,9 @@ const Content = ({ children }) => (
</div> </div>
); );
const App = ({ Component, pageProps }) => ( const App = ({ Component, pageProps }) => {
console.log(process.env.UMAMI_ENABLED);
return (
<Fragment> <Fragment>
<Navbar name={config.navbar.logotype} logo={config.navbar.logo} /> <Navbar name={config.navbar.logotype} logo={config.navbar.logo} />
<Content> <Content>
@ -25,7 +29,15 @@ const App = ({ Component, pageProps }) => (
license={config.footer.license} license={config.footer.license}
commitID={process.env.COMMIT_SHORT_SHA || "HEAD"} commitID={process.env.COMMIT_SHORT_SHA || "HEAD"}
/> />
{process.env.UMAMI_ENABLED ? (
<Script
strategy="beforeInteractive"
src={process.env.UMAMI_SCRIPT_URL}
data-website-id={process.env.UMAMI_WEBSITE_ID}
/>
) : null}
</Fragment> </Fragment>
); );
};
export default App; export default App;

View File

@ -1,5 +1,3 @@
import Script from "next/script";
import { Html, Head, Main, NextScript } from "next/document"; import { Html, Head, Main, NextScript } from "next/document";
const Document = () => { const Document = () => {
@ -9,12 +7,6 @@ const Document = () => {
<body> <body>
<Main /> <Main />
<NextScript /> <NextScript />
{process.env.UMAMI_ENABLED === "true" ? (
<Script
src={process.env.UMAMI_SCRIPT_URL}
data-website-id={process.env.UMAMI_WEBSITE_ID}
/>
) : null}
</body> </body>
</Html> </Html>
); );