import Footer from "./Footer";
import Navigation from "./Navigation";
import { useRouter } from "next/router";
function Layout({ children }) {
const router = useRouter();
return (
<>
{router.pathname !== "/*" && <Navigation />}
{/* {router.pathname !== "*" && <Navigation />} */}
<main className="main-content">{children}</main>
{router.pathname !== "/*" && <Footer />}
{/* {router.pathname !== "*" && <Footer />} */}
</>
);
}
export default Layout;
Unfortunately the methods with an asterisk do not work :/ ?!?
Thank you in advance and best regards for everyone ;-)
import Footer from "./Footer";
import Navigation from "./Navigation";
import { useRouter } from "next/router";
function Layout({ children }) {
const router = useRouter();
return (
<>
{router.pathname !== "/*" && <Navigation />}
{/* {router.pathname !== "*" && <Navigation />} */}
<main className="main-content">{children}</main>
{router.pathname !== "/*" && <Footer />}
{/* {router.pathname !== "*" && <Footer />} */}
</>
);
}
export default Layout;
Unfortunately the methods with an asterisk do not work :/ ?!?
Thank you in advance and best regards for everyone ;-)
Share edited Mar 24, 2023 at 19:57 Robert 8,71356 gold badges135 silver badges175 bronze badges asked Sep 20, 2021 at 13:34 MarioG8MarioG8 6,0014 gold badges19 silver badges31 bronze badges 3-
2
if page is 404 or 500 pathname is always
/_error
so{router.pathname !== "/_error" && <Navigation />}
– Nico Commented Sep 20, 2021 at 14:02 - Thanks Nico