cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x]: Nested entry URLs aren't updated when owner's slug changes

Open daltonrooney opened this issue 5 months ago • 2 comments

What happened?

Description

An entry contains a matrix field where the nested entries have public URLs. The entry URI format looks like {owner.uri}/{slug} Changing the slug on the parent entry and re-saving does not update the URL of the nested entries.

Steps to reproduce

  1. Create a section with a URL structure like test-section/{slug}.
  2. Create a matrix field on the section entry type with a URL pattern of {owner.uri}/{slug}
  3. Create a new entry with multiple nested entries. The URL structure of the entry and children will look something like this:

Parent Entry: https://msa.ddev.site/test-section/entry-with-nested-blocks

Nested block 1 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-1 Nested block 2 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-2 Nested block 3 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-3

  1. Update the slug of the parent entry and resave. The URL structure now looks like this:

Parent Entry: https://msa.ddev.site/test-section/entry-with-changed-title-and-slug

Nested block 1 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-1 Nested block 2 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-2 Nested block 3 - https://msa.ddev.site/test-section/entry-with-nested-blocks/nested-block-3

Expected behavior

The nested entries URLs should be updated as well. This can be prompted with craft resave/entries.

Craft CMS version

5.8.15

PHP version

8.3

Operating system and version

DDEV ubuntu 24

Database type and version

MySQL 8.0.40

Image driver and version

No response

Installed plugins and versions

Performed with safe mode enabled.

daltonrooney avatar Aug 25 '25 17:08 daltonrooney

This also happens if you delete the parent entry (with the first "Delete" option, not "Delete (with descendants)"). The children are moved up one level, but the URLs are still the same.

Resaving a child after deleting the parent updates the URL.

kbergha avatar Sep 12 '25 11:09 kbergha