I have a Next 13 app dir project in production, I am seeing the metadata for all routes except one specific route.
Attached is a screenshot of the project directory, the /cabins route has a page.tsx which is a client component and it also uses useSearchParams, and a layout.tsx where I define the metadata.
I use useSearchParams to set a query on the URI either /cabins?category=general or /cabins?category=accommodation
Here is the layout.tsx code:
return {
title: 'Our Cabins | Site Name',
description:
'Browse our selection of portable cabins, each designed with comfort and functionality in mind. Find the perfect cabin for your needs.',
locale: 'en_NZ',
type: 'website',
url: 'https://www.sitename.co.nz/cabins',
siteName: 'Site Name',
keywords: [
'cabins nz',
'portable cabins',
'portable cabins nz',
'portable buildings',
'portable buildings nz',
'trademe portable cabins',
'trademe portable buildings',
'just cabins',
'cabins',
'cabins for sale',
'kitset cabins nz',
'tiny homes',
'tiny homes nz',
'tiny homes for sale',
'tiny homes for sale nz',
'nz tiny homes',
'small homes nz',
'small cabins nz',
],
}
}
export default function CabinsLayout({ children }: { children: React.ReactNode }) {
return <section>{children}</section>
}```
This layout.tsx code works for all other routes without any issues.
This route also has dynamic child routes [model] slug which just has a page.tsx and the metadata is generated there and is working for all the model routes.
If anyone can see what i'm doing wrong, please let me know, any help is appreciated, thanks in advanced!
Below attached is also the start of the /cabins page.tsx