Thinkmill / Thinkmill/keystatic

can't access /keystatic route with Astro i18n integration and prefixDefaultLocale: true

Open
#1,077 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
2.4k
Forks
159
Avg merge
21h 41m
Merged PRs (30d)
2

Description

Hi, I'm setting up keystatic in a localized project where the first segment of my url is the language locale.

my-domain.com/en/......
mydomain.com/es/.....

I'm not able to enter the keystatic panel because the localhost:4321/keystatic is matched by the src/pages/[lang] route.

I actually found the place where this configured and I added the /en prefix to make it work changing directly the file in my node_modules folder.

ui pattern
api pattern

injectRoute({
          // @ts-ignore
          entryPoint: '@keystatic/astro/internal/keystatic-astro-page.astro',
          entrypoint: '@keystatic/astro/internal/keystatic-astro-page.astro',
          pattern: '/en/keystatic/[...params]',
          prerender: false
        });
        injectRoute({
          // @ts-ignore
          entryPoint: '@keystatic/astro/internal/keystatic-api.js',
          entrypoint: '@keystatic/astro/internal/keystatic-api.js',
          pattern: '/en/api/keystatic/[...params]',
          prerender: false
        });

is there a way to set this up through normal config? I think it could be a useful feature

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/astro/src/index.ts, especially the UI and API route patterns linked in the issue, and reproduce the setup with an Astro src/pages/[lang] route and prefixDefaultLocale enabled. Check how the generated /keystatic and /api/keystatic routes are matched; done means localized projects can configure the locale prefix without editing node_modules and the Keystatic panel and API remain reachable.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
internationalization, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.