File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -416,7 +416,7 @@ public function save()
416416
417417 $ this ->taxonomize ();
418418
419- if ($ this ->isDirty ( ' slug ' )) {
419+ if ($ this ->shouldUpdateUris ( )) {
420420 optional (Collection::findByMount ($ this ))->updateEntryUris ();
421421 $ this ->updateChildPageUris ();
422422 }
@@ -448,6 +448,21 @@ public function save()
448448 return true ;
449449 }
450450
451+ private function shouldUpdateUris (): bool
452+ {
453+ if (! $ this ->route ()) {
454+ return false ;
455+ }
456+
457+ $ antlersRoute = preg_replace_callback ('/{\s*([a-zA-Z0-9_\-]+)\s*}/ ' , function ($ match ) {
458+ return "{{ {$ match [1 ]} }} " ;
459+ }, $ this ->route ());
460+
461+ return collect (Antlers::identifiers ($ antlersRoute ))
462+ ->filter (fn (string $ identifier ) => $ this ->isDirty ($ identifier ))
463+ ->isNotEmpty ();
464+ }
465+
451466 private function updateChildPageUris ()
452467 {
453468 $ collection = $ this ->collection ();
You can’t perform that action at this time.
0 commit comments