-
Hi, guys! 👋 I’ve been struggling with an i18n metadata issue when using next-intl and would really appreciate some guidance from the community. Brief contextI try to migrate nextjs project to cloudflare workers. The project uses opennextjs as the adapter, and next-intl for i18n. When using next-intl in as-needed mode, the canonical URL in metadata shows the correct path (https://mysite.com/) during next dev, but incorrectly appends the default locale (/en) during next preview or production builds. This violates the as-needed mode specification where default locales shouldn't appear in URLs. Steps to reproduceCreate a Next.js project with nextjs, opennextjs and next-intl (v3+) Configure i18n with as-needed mode:
Set metadata with relative canonical:
Run Expected behaviorCanonical URL should consistently omit default locale prefixes in as-needed mode across all environments: Dev: https://mysite.com/ Environmentnextjs version: 15.3.3 __ QuestionCould anyone help me diagnose this? Specifically looking for:
Thanks so much for your time! Any pointers would be incredibly helpful 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you're using What you could do is using |
Beta Was this translation helpful? Give feedback.
Not that I'm aware of. I think declaring canonicals on each page where they're needed is likely necessary.