Skip to content
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

How is metadataFields supposed to work? #170

Open
rijk opened this issue Jan 14, 2024 · 1 comment
Open

How is metadataFields supposed to work? #170

rijk opened this issue Jan 14, 2024 · 1 comment

Comments

@rijk
Copy link

rijk commented Jan 14, 2024

Apologies as this is not a bug, but a question. I've read the docs, the special doc page on this, and looked through the source code, but I cannot figure out how metadataFields is supposed to work.

I've added it to my config:

documentInternationalization({
  supportedLanguages: [
    {id: 'nl', title: 'Nederlands'},
    {id: 'en', title: 'English'},
  ],
  schemaTypes: ['home', 'settings', 'page'],
  metadataFields: [defineField({name: 'slug', type: 'slug'})],
}),

But it doesn't seem to do anything. I still get the Slug is already in use error on page translations:

image

Am I misunderstanding how to use this?

@sail-stian
Copy link

Probably a bit late to answer here, but I was also confused by this. When you add the metadataFields option it does not move the field from the document, it simply creates a new field in the language document (go to "manage translations" on the relevant document to see it). I assume what is ment in the documentation is that you can use the slug field in the language document instead of the slug field in the original documents.

I hope this helps someone. I ended up using a custom uniqueness check instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants