From 7ff2ff9883cd73fdb4a85ec4122d93c1eec42094 Mon Sep 17 00:00:00 2001 From: Ben Bjurstrom Date: Wed, 4 Sep 2024 09:54:32 -0700 Subject: [PATCH] Update withUrl --- src/SEOManager.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SEOManager.php b/src/SEOManager.php index 2cfd4c4..706f2fb 100644 --- a/src/SEOManager.php +++ b/src/SEOManager.php @@ -224,9 +224,13 @@ class SEOManager } /** Append canonical URL tags to the document head. */ - public function withUrl(): static + public function withUrl(?string $origin = null): static { - $this->url(request()->url()); + if($origin){ + $this->url(trim($origin, '/') . '/' . trim(request()->path(), '/')); + }else{ + $this->url(request()->url()); + } return $this; }