Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Bug with metadata alternates when using URL | GoodFirstPicks

Bug with metadata alternates when using URL

vercel/next.js 6 comments 14d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Metadata alternates URL generation appears incorrect but root cause is unclear.

AI Summary

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.

Issue Description

Link to the code that reproduces this issue

https://github.com/votemike/alternate-urls

To Reproduce

  • Start the application in development
  • Visit the homepage
  • Inspect the alternate URLs in the HTML
  • Notice the US one does not contain the US suffix

Current vs. Expected behavior

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

Provide environment information

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

Which area(s) are affected? (Select all that apply)

Metadata

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

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.

Screenshot 2024-07-31 at 10 31 34

Screenshot
2024-07-31 at 10 30 44

GitHub Labels

bugMetadatalinear: next

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!

Risk Flags

  • metadata handling
  • URL generation logic
Loading labels...

Details

Points15 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno