Skip to content

Commit 43bedff

Browse files
authored
Avoid calling absoluteUrl() as it slows down responses (#26)
2 parents 687b481 + 2ed8ac6 commit 43bedff

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/Http/Middleware/CacheTracker.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,21 @@ private function setupAugmentationHooks(string $url)
124124
});
125125

126126
app(Entry::class)::hook('augmented', function ($augmented, $next) use ($self, $url) {
127-
if ($this->absoluteUrl() != $url) {
128-
$self->addContentTag($this->collection()->handle().':'.$this->id());
129-
}
127+
$self->addContentTag($this->collection()->handle().':'.$this->id());
130128

131129
return $next($augmented);
132130
});
133131

134132
Page::hook('augmented', function ($augmented, $next) use ($self, $url) {
135-
$entry = $this->entry();
136-
137-
if ($entry && $entry->absoluteUrl() != $url) {
133+
if ($entry = $this->entry()) {
138134
$self->addContentTag($entry->collection()->handle().':'.$entry->id());
139135
}
140136

141137
return $next($augmented);
142138
});
143139

144140
LocalizedTerm::hook('augmented', function ($augmented, $next) use ($self, $url) {
145-
if ($this->absoluteUrl() != $url) {
146-
$self->addContentTag('term:'.$this->id());
147-
}
141+
$self->addContentTag('term:'.$this->id());
148142

149143
return $next($augmented);
150144
});

0 commit comments

Comments
 (0)