Skip to content

URL in Stache does not update correctly when using custom routes #13828

@lostgeek

Description

@lostgeek

Bug description

The route of an entry is typically using the slug, but can be customised pretty heavily (example in screenshot).
Image

When saving the entry, the URL in the stache does not update correctly, as the code only checks for changes in the slug:

cms/src/Entries/Entry.php

Lines 448 to 451 in 2724468

if ($this->isDirty('slug')) {
optional(Collection::findByMount($this))->updateEntryUris();
$this->updateChildPageUris();
}

Possible solution

Either go through the pain of figuring out which fields in the blueprint are relevant for route creation, or simply check if any field is dirty when custom routing rules are set.

How to reproduce

  1. Create collection with custom routes
  2. Change existing entry editing one of the fields that are used in the custom route but not editing the slug
  3. Check resulting URL of the entry

Logs

Environment

Statamic
Addons: 3
Sites: 4 (🇩🇪 Deutsch, 🇫🇷 Français, 🇮🇹 Italiano, 🇬🇧 English)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.69.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions