Skip to content

[6.x] Fix duplicate slugs allowed with depth-conditional routes#14508

Merged
jasonvarga merged 5 commits into6.xfrom
duplicate-uris
Apr 17, 2026
Merged

[6.x] Fix duplicate slugs allowed with depth-conditional routes#14508
jasonvarga merged 5 commits into6.xfrom
duplicate-uris

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

This pull request fixes an issue where duplicate slugs were allowed for child entries in structured collections when using a route configuration that references depth (e.g. {{ if depth > 1 }}{{ parent_uri }}/{{ slug }}{{ else }}base/{{ slug }}{{ /if }}).

This was happening because the depth variable was not being passed to the URL builder during unique URI validation in EntriesController::entryUri(). There was a // 'depth' => '', // todo placeholder where it should have been calculated. Without depth, the Antlers conditional in the route couldn't evaluate correctly, so the generated URI during validation didn't match the actual URI, and duplicates weren't detected.

This PR fixes it by calculating the depth from the parent page's depth and passing it to the URL builder.

Fixes #14482

@jasonvarga jasonvarga merged commit 2a2966f into 6.x Apr 17, 2026
17 checks passed
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.

Duplicate slugs allowed with custom route configuration

2 participants