Skip to content

Commit

Permalink
Don't create entry redirects if the entry isn't published
Browse files Browse the repository at this point in the history
  • Loading branch information
riasvdv committed May 4, 2024
1 parent f96b22e commit 07d6df6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Listeners/CacheOldUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ public function handle(EntrySaving $entrySaving)
if (! config('statamic.redirect.enable', true)) {
return;
}

$id = $entrySaving->entry->id();

Blink::forget('eloquent-entry-'.$id);
$entry = Entry::find($id);

if (! $entry || ! $uri = $entry->uri()) {
return;
}

if (! $entry->published()) {
return;
}

Cache::put('redirect-entry-uri-before', $uri);
}
}

0 comments on commit 07d6df6

Please sign in to comment.