Skip to content

fix: Update URL resolution logic to handle search parameters on root path /?foo=bar #78262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

F7b5
Copy link

@F7b5 F7b5 commented Apr 16, 2025

What?

This PR fixes and implements test for an URL resolution issue that stripped the searchparam when metadataBase was defined and a search param was set on the root path. This created a behavior where :

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
  metadataBase: new URL("https://www.example.com"),
  alternates: {
    canonical: "/?foo=bar",
  },
};

would result in

<link rel="canonical" href="https://www.example.com">

instead of

<link rel="canonical" href="https://www.example.com/?foo=bar">

Related issues

@ijjk
Copy link
Member

ijjk commented Apr 16, 2025

Allow CI Workflow Run

  • approve CI run for commit: 9470f2b

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants