DescriptionI have translated blogs. and I have each locale has its own translated slug. http://localhost:3000/en/blog/healthy-nutrition-for-children-complete-guide-from-birth-to-5-years however, in englsih version, when i open network tab, response headers, link section; i see this: http://localhost:3000/en/blog/healthy-nutrition-for-children-complete-guide-from-birth-to-5-years; rel="alternate"; hreflang="en", http://localhost:3000/de/blog/healthy-nutrition-for-children-complete-guide-from-birth-to-5-years; rel="alternate"; hreflang="de", http://localhost:3000/healthy-nutrition-for-children-complete-guide-from-birth-to-5-years/%D9%88%D8%A8%D9%84%D8%A7%DA%AF; rel="alternate"; hreflang="fa", http://localhost:3000/healthy-nutrition-for-children-complete-guide-from-birth-to-5-years/%D9%88%D8%A8%D9%84%D8%A7%DA%AF; rel="alternate"; hreflang="x-default" the issue is that crawlers will mess up in indexing pages because they are using this response as well! in the farsi version, the situation is even worse, because slugs are not even inserted: x-middleware-rewrite Verifications
Mandatory reproduction URLhttps://github.com/sahandsn/OsifyAI-Frontend-Test Reproduction descriptionrepository is linked to a vercel deployment, you can open the single blog and check the response headers in different languages. "next": "15.5.18", Expected behaviouri expected that in both locales, slugs are inserted correctly based on the target locale. and no redirect.rewrite is neeeded. |
Replies: 2 comments 1 reply
|
OMG! someone ran into the same issue as me... |
|
Hey, thanks for the detailed report! I had a look at your reproduction: localized blog slugs come from MDX frontmatter ( One thing I'd double-check in The Two ways to fix this:
Docs: alternate links, localized pathnames. I'll move this to a discussion since it's a usage question. |
Hey, thanks for the detailed report!
I had a look at your reproduction: localized blog slugs come from MDX frontmatter (
slug/sharedSlug), resolved at runtime viasharedSlug— that part looks good.One thing I'd double-check in
routing.ts: forfayou have"/[slug]/وبلاگ". Putting[slug]first isn't something RTL requires — URLs stay LTR, and most sites keep the same segment order across locales as far as I know (only the static label and slug text change, e.g./fa/وبلاگ/[slug]).The
Linkresponse header is a separate code path. Nothing in your app feeds MDX content intopathnames— that object inrouting.tsis static templates only.Two ways to fix this:
pathnamesdynamically: S…