Metadata alternates URL generation appears incorrect but root cause is unclear.
The issue reports incorrect URL generation for metadata alternates, specifically missing US suffixes. While the expected behavior is described, the root cause isn't immediately clear from the code or comments. The problem appears localized to metadata handling but may require understanding Next.js internals.
https://github.com/votemike/alternate-urls
Expected:
I expect the HTML to contain <link rel="alternate" hreflang="en-GB" href="https://example.com"> and <link rel="alternate" hreflang="en-US" href="https://example.com/us">
Current:
The HTML does not contain the US suffix on the URL
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Wed Apr 24 06:02:02 PDT 2024; root:xnu-8020.240.18.708.4~1/RELEASE_X86_64
Available memory (MB): 16384
Available CPU cores: 4
Binaries:
Node: 18.18.0
npm: 9.8.1
Yarn: 1.22.10
pnpm: N/A
Relevant Packages:
next: 15.0.0-canary.94 // Latest available version is detected (15.0.0-canary.94).
eslint-config-next: N/A
react: 19.0.0-rc-3208e73e-20240730
react-dom: 19.0.0-rc-3208e73e-20240730
typescript: 5.3.3
Next.js Config:
output: N/A
Metadata
next dev (local), next build (local), next start (local), Vercel (Deployed)
I found this bug in Next 14.1.1 Casting the URL to a string gives me the output I expect. Not sure why the HTML doesn't reflect this.
Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!