We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b3623c commit f5bb126Copy full SHA for f5bb126
src/components/Header/Header.tsx
@@ -7,13 +7,14 @@ interface HeaderProps {
7
}
8
9
const Header = ({ data }: HeaderProps) => {
10
- const location = useLocation()
+ const { pathname } = useLocation()
11
12
- const currentNavItem = siteConfig.navItems.find(
13
- (item) => item.href.toLowerCase() === location.pathname.toLowerCase()
14
- )
+ const getPageLabel = () => {
+ const allNavItems = [...siteConfig.navItems, ...siteConfig.navItemsAccord]
+ return allNavItems.find((item) => item.href.toLowerCase() === pathname.toLowerCase())?.label
15
+ }
16
- const pageTitle = currentNavItem ? currentNavItem.label : 'Page'
17
+ const pageTitle = getPageLabel()
18
19
return (
20
<>
0 commit comments