fix: scope slug uniqueness check to same language#18
Merged
kenjonespizza merged 9 commits intomainfrom Mar 11, 2026
Merged
Conversation
Adds isUniqueOtherThanLanguage helper that allows translated documents to share the same slug across different languages. Applied to article, editorialTopic, and tag schema types. See: https://github.com/sanity-io/document-internationalization/blob/main/docs/05-allowing-the-same-slug-for-translations.md Co-authored-by: assistant <assistant@miriad.systems>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: leaddev <leaddev@miriad.systems>
shehjad-noqtaai
approved these changes
Mar 11, 2026
Contributor
shehjad-noqtaai
left a comment
There was a problem hiding this comment.
Code looks good, one of the checks on format is failing please check that
…ith CI The pre-commit hook runs oxfmt from the repo root, but starters have their own .oxfmtrc.json with the project conventions (no semis, single quotes, etc.). Without a root config, the hook used oxfmt defaults and reformatted files incorrectly on every commit, causing CI to fail.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a custom slug uniqueness validator (
isUniqueOtherThanLanguage) that scopes slug uniqueness to the same language. This allows translated documents to share the same slug across different languages, while still enforcing uniqueness within the same language.Changes
agentic-localization/studio/lib/isUniqueOtherThanLanguage.ts— custom slug validation helperarticle.ts,editorialTopic.ts,tag.ts— slug fields now useisUniqueOtherThanLanguageHow it works
The validator queries for existing documents with the same slug and the same language, excluding the current document and its versions. If no match is found, the slug is considered unique.
Reference