Change in _app.jsx
. It is located in the same directory where package.json
reside.
import { GoogleAnalytics } from "nextjs-google-analytics";
import { NavigationBar } from '../components/navbar/NavigationBar';
export default function MyApp({ Component, pageProps, router }) {
/**
* Show navigation bar everywhere except uri listed in excludeUris.
* @param {*} pathname
* @param {*} excludeUris e.g. ["/ythumb", "/ssd"];
* @returns
*/
function showNavigationBar(pathname, excludeUris) {
for(const uri of excludeUris) {
if(pathname.includes(uri))
return false;
}
return true;
}
const excludeUris = [
"/convert-to-different-timeszones",
"/utc-to-local",
"/ythumb",
"/ssd",
];
return (
<>
<GoogleAnalytics trackPageViews />
{ showNavigationBar(router.pathname, excludeUris) && <NavigationBar /> }
<Component {...pageProps} />
</>
);
}