Skip to content
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

Canonical URLs with path extension (e.g. .html) get a trailing slash when it shouldn't #66635

Closed
kshehadeh opened this issue Jun 7, 2024 · 1 comment · Fixed by #66636
Closed
Labels
bug Issue was opened via the bug report template. locked Metadata Related to Next.js' Metadata API.

Comments

@kshehadeh
Copy link
Contributor

Link to the code that reproduces this issue

kshehadeh/nextjs-routing-sandbox@04fffc1

To Reproduce

  1. Set the trailingSlash config for a project to true
  2. Add an app router page that includes a generateMetadata which returns a canonical url that ends with .html
  3. Run page and observe that canonical ends with .html/

Current vs. Expected behavior

Current: canonical ends with .html/
Expected: canonical ends with .html

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 18.17.0
  npm: 10.2.5
  Yarn: N/A
  pnpm: 8.15.7
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.0.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
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 start (local), Vercel (Deployed)

Additional context

I believe it was introduced with this PR: https://github.com/vercel/next.js/pull/62109/files

@kshehadeh kshehadeh added the bug Issue was opened via the bug report template. label Jun 7, 2024
@github-actions github-actions bot added the Metadata Related to Next.js' Metadata API. label Jun 7, 2024
huozhi added a commit that referenced this issue Jun 11, 2024
… extension (#66636)

### What

Skip adding trailing slash for file pattern like same origin urls

### Why

Fixes #66635

Next.js will not append trailing slash for file like pattern urls when
`trailingSlash` is enabled. This PR aligns the behavior of the metadata
trailing slash appending with next-server route handling.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
huozhi added a commit that referenced this issue Jun 11, 2024
… extension (#66636)

### What

Skip adding trailing slash for file pattern like same origin urls

### Why

Fixes #66635

Next.js will not append trailing slash for file like pattern urls when
`trailingSlash` is enabled. This PR aligns the behavior of the metadata
trailing slash appending with next-server route handling.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked Metadata Related to Next.js' Metadata API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant