Skip to content

Commit 6699eca

Browse files
Merge pull request #265 from Web-Dev-Path/fix/meta-title-fallback-bug
Resolve incorrect meta tag rendering for nested
2 parents e979738 + ce3fa2f commit 6699eca

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
123123
- Added theming to the project
124124
- Created single blog post page
125125
- Connected Dev.to API with single post UI
126-
- Added Shayla to 'about us'
127126

128127
### Fixed
129128

@@ -151,10 +150,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
151150
- Added Faith to 'about us'
152151
- Updated Mariana's title in 'about us'
153152
- Updated outdated dependencies
153+
- Added Shayla to 'about us'
154154

155155
### Fixed
156156

157157
- Updated husky script to avoid warning
158+
- Resolved incorrect meta tag rendering for nested routes
158159

159160
### Changed
160161

components/layout/Meta.js

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

66
export default function Meta() {
77
const currentPath = usePathname();
8-
const meta = currentPath in pageMeta ? pageMeta[currentPath] : pageMeta['/'];
8+
const firstSegment = '/' + currentPath?.split('/')[1];
9+
const meta =
10+
firstSegment in pageMeta ? pageMeta[firstSegment] : pageMeta['/'];
911
return (
1012
<>
1113
<Head>

0 commit comments

Comments
 (0)