Skip to content

Fix duplicate entries being created when the unique field is the slug - #151

Merged
duncanmcclean merged 1 commit into
2.xfrom
slug-unique-field
Sep 22, 2026
Merged

duncanmcclean merged 1 commit into
2.xfrom
slug-unique-field

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where re-running an import with "Update existing items" enabled and slug as the unique field would create duplicate entries instead of updating the existing ones.

This was happening because Statamic slugifies an entry's slug when it's saved (so Hello World is stored as hello-world), but the importer was looking up existing entries using the raw value from the import file, which never matched.

This PR fixes it by slugifying the value before querying for an existing entry when the unique field is the slug, using the site's language so it matches what Statamic stores.

Fixes #150

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@duncanmcclean
duncanmcclean merged commit f7f0899 into 2.x Sep 22, 2026
16 checks passed
@duncanmcclean
duncanmcclean deleted the slug-unique-field branch September 22, 2026 08:08
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.

Update creates duplicate entries

1 participant