Skip to content

getPath returns ancestor URLs using fallback locale instead of requested locale #439

Description

@rawnanoob

Hi

In the CMS, we have configured multiple locales to fall back to en, for example:

en-CN → en
en-LU → en

When calling getPath with the en locale:

client.getPath({
  key: context.key,
  locale: "en",
});

the returned ancestor pages contain _metadata.url.default values that use the internally resolved fallback locale rather than the requested locale.

Current behavior

The ancestor URLs are returned as:

/en-CN/
/en-LU/content-page

Expected behavior

The ancestor URLs should be relative to the requested locale (en):

/en/
/en/content-page

_metadata.url.default for each ancestor should always reflect the URL for the requested locale, regardless of which locale was used internally as a fallback to resolve the content.

Expected behaviour: _metadata.url.default on each ancestor should reflect a URL for the requested locale, not the locale it fell back to internally.

Also if we call:

client.getPath({
key: context.key,
locale: "en-BE",
});

The query fails with the following:

HTTP 400: Variable "$locale" got invalid value "en-BE" at "locale[0]"; Value "en-BE" does not exist in "Locales" enum. Did you mean the enum value "en_BE", "en_DE", "en", "en_CH", or "en_CN"?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions