Skip to content

fix: scope slug uniqueness check to same language#18

Merged
kenjonespizza merged 9 commits intomainfrom
fix/slug-uniqueness-per-language
Mar 11, 2026
Merged

fix: scope slug uniqueness check to same language#18
kenjonespizza merged 9 commits intomainfrom
fix/slug-uniqueness-per-language

Conversation

@kenjonespizza
Copy link
Contributor

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

  • New file: agentic-localization/studio/lib/isUniqueOtherThanLanguage.ts — custom slug validation helper
  • Updated: article.ts, editorialTopic.ts, tag.ts — slug fields now use isUniqueOtherThanLanguage

How 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.

  • ✅ Same slug, different language → allowed
  • ❌ Same slug, same language → rejected

Reference

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>
@vercel
Copy link

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-shopping-assistant Ready Ready Preview, Comment Mar 11, 2026 9:57pm

Request Review

Co-authored-by: leaddev <leaddev@miriad.systems>
Copy link
Contributor

@shehjad-noqtaai shehjad-noqtaai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@kenjonespizza kenjonespizza temporarily deployed to ai-shopping-assistant March 11, 2026 21:55 — with GitHub Actions Inactive
@kenjonespizza kenjonespizza temporarily deployed to agentic-localization March 11, 2026 21:55 — with GitHub Actions Inactive
@kenjonespizza kenjonespizza temporarily deployed to agentic-localization March 11, 2026 21:55 — with GitHub Actions Inactive
@kenjonespizza kenjonespizza merged commit 0b6eaf7 into main Mar 11, 2026
5 checks passed
@kenjonespizza kenjonespizza deleted the fix/slug-uniqueness-per-language branch March 11, 2026 21:58
kenjonespizza added a commit that referenced this pull request Mar 13, 2026
…i18n, editorial workflow, and slug uniqueness

Reflects recent PRs (#15, #18, #20, #21): adds field-level localization
section, slug uniqueness per language, editorial review workflow
(review → approved → stale + publish gating), and Sanity Functions to
the system diagram.
kenjonespizza added a commit that referenced this pull request Mar 17, 2026
…i18n, editorial workflow, and slug uniqueness (#22)

Reflects recent PRs (#15, #18, #20, #21): adds field-level localization
section, slug uniqueness per language, editorial review workflow
(review → approved → stale + publish gating), and Sanity Functions to
the system diagram.
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

Successfully merging this pull request may close these issues.

2 participants