fix: handle undefined path in footer component for improved stability

This commit is contained in:
Dries Augustyns
2026-05-12 08:35:12 +02:00
parent ccd516e4e8
commit 715961c007
@@ -9,7 +9,7 @@ import logo from '../../../public/assets/logo.svg';
*/ */
export default function Footer() { export default function Footer() {
const router = useRouter(); const router = useRouter();
const path = (router.asPath || '/').split(/[?#]/)[0]; const path = (router.asPath || '/').split(/[?#]/)[0] ?? '/';
const trimmed = path === '/' ? '/' : path.replace(/\/$/, ''); const trimmed = path === '/' ? '/' : path.replace(/\/$/, '');
const mdHref = `${trimmed}.md`; const mdHref = `${trimmed}.md`;
return ( return (