Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Allow mixing localized pathnames and unknown routes #1675

Closed
oskari opened this issue Jan 23, 2025 · 1 comment
Closed

Allow mixing localized pathnames and unknown routes #1675

oskari opened this issue Jan 23, 2025 · 1 comment
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@oskari
Copy link

oskari commented Jan 23, 2025

Is your feature request related to a problem? Please describe.

We have an app that uses both localized pathnames for few static paths but rest of the routes are handled by our CMS. We handle our routes with src/app/[locale]/[[...slug]] app router path, but we want to define few routes in the config, eg.:


export const routing = defineRouting({
  locales: ['en', 'es'],
  defaultLocale: 'en',
  localeDetection: false,
  localePrefix: "as-needed",
  localeCookie: false,
  alternateLinks: false,

  pathnames: {
    "/route-example/[slug]": {
      en: "/some-static-route-path/[slug]",
      es: "/some-static-route-path-in-es/[slug]",
    },
    "/another-path/[slug]": {
      en: "/static-route/[slug]",
      es: "/static-route-es/[slug]",
    },
  },
})

but this doesn't seem to be possible, as redirect expects the href to be on of the pathnames defined, when it should be string | pathnames ?

Describe the solution you'd like

Allow mixing localized paths and unknown routing

Describe alternatives you've considered

We've currently had to resort on using our own middleware to handle localized paths

@oskari oskari added enhancement New feature or request unconfirmed Needs triage. labels Jan 23, 2025
@amannn
Copy link
Owner

amannn commented Jan 24, 2025

I think you could probably add [[...slug]] to the pathnames config to allow arbitrary slugs in addition to a few known pathnames.

I'll move this to a discussion since it's a usage question.

Repository owner locked and limited conversation to collaborators Jan 24, 2025
@amannn amannn converted this issue into discussion #1678 Jan 24, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants