Skip to content

[5.x] Fixes shouldUpdateUris regex adding additional brackets to Antlers#13995

Open
martyf wants to merge 1 commit intostatamic:5.xfrom
martyf:fix/should-update-uris-regex-issue
Open

[5.x] Fixes shouldUpdateUris regex adding additional brackets to Antlers#13995
martyf wants to merge 1 commit intostatamic:5.xfrom
martyf:fix/should-update-uris-regex-issue

Conversation

@martyf
Copy link
Contributor

@martyf martyf commented Feb 18, 2026

This PR revises the regex to improve Antlers support in the route configuration for a Collection.

My Collection has a route of:

{{ if depth > 1 }}{{ parent_uri }}/{{ slug }}{{ else }}portal/brands/{{ slug }}{{ /if }}

The $antlersRoute with the original regex becomes:

{{ if depth > 1 }}{{{ parent_uri }}}/{{{ slug }}}{{{ else }}}portal/brands/{{{ slug }}}{{ /if }}

Notice the triple { and }?

This causes an error when saving:

Unpaired "else" control structure

This update revises the regex to allow Antlers without adding additional brackets, so the $antlersRoute correctly returns

{{ if depth > 1 }}{{ parent_uri }}/{{ slug }}{{ else }}portal/brands/{{ slug }}{{ /if }}

again.

This would also need to be rolled up to Statamic 6 too.

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.

1 participant

Comments