-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional origin to withUrl #38
base: master
Are you sure you want to change the base?
Changes from 3 commits
7ff2ff9
cbb33fa
7937fec
ac434ea
85e5acb
0b2ff24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,8 @@ | ||||||||||
<?php | ||||||||||
|
||||||||||
use ArchTech\SEO\SEOManager; | ||||||||||
use Illuminate\Http\Request; | ||||||||||
use Mockery\MockInterface; | ||||||||||
benbjurstrom marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
test('set returns the set value', function () { | ||||||||||
expect(seo()->set('foo', 'bar'))->toBe('bar'); | ||||||||||
|
@@ -118,6 +120,16 @@ | |||||||||
->toContain('<link rel="canonical" href="http://localhost" />'); | ||||||||||
}); | ||||||||||
|
||||||||||
test('canonical url accepts origin', function () { | ||||||||||
$this->get('/testing/5'); | ||||||||||
|
||||||||||
seo()->withUrl('https://foo.com'); | ||||||||||
|
||||||||||
expect(meta()) | ||||||||||
->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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you link MDN docs or something where I can see that both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
|
||||||||||
}); | ||||||||||
|
||||||||||
test('canonical url can be changed', function () { | ||||||||||
seo()->withUrl(); | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is origin the right term here, or would canonical be more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
https://www.rfc-editor.org/rfc/rfc6454#section-5