-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
initialCanonicalUrl is not taking into account basePath from config #59971
Comments
Why is this not addressed :/ I have tons of 404 urls because of it in my search console 😓 |
Google won't pick the |
@c0b41 If the assumption is that google crawler read those content and parse it as canonical url, I'd assume there will be a much wider impact. Or it could also be search console having issues with specific app. There're only screenshots in 40143 that is not available to investigate. |
I will be happy to conduct a google meet and show you my own search console how thousands of urls are considered 404 by google because of initialCanonical. |
This shouldn't be closed, 404s and 308, Google is picking up initialCanonicalUrl |
I wonder if it's related to this fix (#67135), when you have a static not found page, but since it's missing |
@huozhi To be honest I dont think so, my site is not statically generated, and I see a noindex tag within the 404 pages. |
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. |
Link to the code that reproduces this issue
https://github.com/zlwaterfield/initial-canonical-url-bug
To Reproduce
self.__next_f.push(....
initialCanonicalUrl
and it will be missing the base path (path
).Also see #53274 for more information.
Current vs. Expected behavior
The
initialCanonicalUrl
should have the basePath included in it.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 Binaries: Node: 18.17.0 npm: 9.6.7 Yarn: 1.22.19 pnpm: 8.12.1 Relevant Packages: next: 14.0.4 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: N/A Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Metadata (metadata, generateMetadata, next/head), Script optimization (next/script)
Additional context
This is causing issues with SEO because crawlers see the URL and think it's a valid URL. From what I gather, there is currently no way to properly set it. We are getting 404s from this in the Google Search Console.
My only idea to fix it right now is to rewrite the URL in our Cloudflare worker until a fix is shipped in Next.js
The text was updated successfully, but these errors were encountered: