Add optional origin to withUrl#38
Conversation
| ->toContain('<meta property="og:url" content="https://foo.com/testing/5" />') | ||
| ->toContain('<link rel="canonical" href="https://foo.com/testing/5" />'); |
There was a problem hiding this comment.
Can you link MDN docs or something where I can see that both og:url and canonical should be the canonical link?
There was a problem hiding this comment.
The package is already coupling og:url and canonical together. All my pull request does is give users the option to manually set the origin.
laravel-seo/resources/views/components/meta.blade.php
Lines 31 to 34 in f6fd5f4
|
|
||
| /** Append canonical URL tags to the document head. */ | ||
| public function withUrl(): static | ||
| public function withUrl(?string $origin = null): static |
There was a problem hiding this comment.
Is origin the right term here, or would canonical be more accurate?
There was a problem hiding this comment.
This RFC says the scheme/host/port combination is an origin. Note that's all we're passing in here. The full canonical url is still derived from the request path.
This pull request adds an optional
$originparameter to thewithUrl()method allowing users to set a fixed origin such ashttps://foo.com. This useful to prevent duplicate content issues with publicly accessible test environments or underlying serverless functions that alias to your domain.