Skip to content

Commit ce3fa2f

Browse files
follow satoshi's suggestion. no build errors noted in console.
1 parent 4ccc832 commit ce3fa2f

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

components/layout/Meta.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ import Script from 'next/script';
55

66
export default function Meta() {
77
const currentPath = usePathname();
8-
let firstSegment = '/';
9-
if (currentPath) {
10-
const segments = currentPath.split('/');
11-
if (segments[1]) {
12-
firstSegment = '/' + segments[1];
13-
}
14-
}
15-
16-
const meta = pageMeta[firstSegment] ? pageMeta[firstSegment] : pageMeta['/'];
8+
const firstSegment = '/' + currentPath?.split('/')[1];
9+
const meta =
10+
firstSegment in pageMeta ? pageMeta[firstSegment] : pageMeta['/'];
1711
return (
1812
<>
1913
<Head>

0 commit comments

Comments
 (0)