-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Open
Open
Copy link
Labels
MetadataRelated to Next.js' Metadata API.Related to Next.js' Metadata API.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
Description
Link to the code that reproduces this issue
https://github.com/jperezr21/static-and-dynamic-metadata
To Reproduce
- Create dynamic path with async
generateMetadata
that setsalternates.canonical
to the path without any query params (let's say/[storeHandle]/[productSlug]
). - Have a selectable property that's reflected in the URL query params (eg:
?variant=[variantName]
) - Have other pages link to the page with the query params (eg: link to specific product variants).
- Google will say there's no user-selected canonical for these pages even though it is (the problem is that the canonical tag is being streamed and it's not present in the initial HTML).
Current vs. Expected behavior
- Current: Google is not detecting user-selected canonical for streamed pages
- Expected: Have the ability for defining both static and dynamic metadata. I want to have the canonical as static, but the rest (product title, description, images, etc) dynamic. This isn't supported at the moment (from the docs):
You cannot export both the metadata object and generateMetadata function from the same route segment.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:29 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 11
Binaries:
Node: 22.13.1
npm: 11.1.0
Yarn: N/A
pnpm: 10.12.1
Relevant Packages:
next: 15.3.4 // Latest available version is detected (15.3.4).
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: N/A
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Metadata
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
l-you, jperezr21, konvar, habeckjohn and FranciscoMoretti
Metadata
Metadata
Assignees
Labels
MetadataRelated to Next.js' Metadata API.Related to Next.js' Metadata API.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.