From 2ed8ac699f25ac76a86852526a1e1cd48f7e3010 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Thu, 4 Sep 2025 07:23:09 +0100 Subject: [PATCH] Avoid calling absoluteUrl() as it slows down responses --- src/Http/Middleware/CacheTracker.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Http/Middleware/CacheTracker.php b/src/Http/Middleware/CacheTracker.php index 4fde403..f0373d7 100644 --- a/src/Http/Middleware/CacheTracker.php +++ b/src/Http/Middleware/CacheTracker.php @@ -124,17 +124,13 @@ private function setupAugmentationHooks(string $url) }); app(Entry::class)::hook('augmented', function ($augmented, $next) use ($self, $url) { - if ($this->absoluteUrl() != $url) { - $self->addContentTag($this->collection()->handle().':'.$this->id()); - } + $self->addContentTag($this->collection()->handle().':'.$this->id()); return $next($augmented); }); Page::hook('augmented', function ($augmented, $next) use ($self, $url) { - $entry = $this->entry(); - - if ($entry && $entry->absoluteUrl() != $url) { + if ($entry = $this->entry()) { $self->addContentTag($entry->collection()->handle().':'.$entry->id()); } @@ -142,9 +138,7 @@ private function setupAugmentationHooks(string $url) }); LocalizedTerm::hook('augmented', function ($augmented, $next) use ($self, $url) { - if ($this->absoluteUrl() != $url) { - $self->addContentTag('term:'.$this->id()); - } + $self->addContentTag('term:'.$this->id()); return $next($augmented); });