From cd129f938b336f4288c924feeb575365d927589c Mon Sep 17 00:00:00 2001 From: Serhii Andriichuk Date: Sun, 11 Sep 2022 11:12:49 +0300 Subject: [PATCH] Resolve an issue with hreflang url attribute --- src/MetaTags.php | 2 +- tests/MetaTagsTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MetaTags.php b/src/MetaTags.php index 832397b..9b45c8b 100644 --- a/src/MetaTags.php +++ b/src/MetaTags.php @@ -155,7 +155,7 @@ public function hreflang(string $lang, string $url): MetaTags { return $this->push('link', [ 'rel' => 'alternate', - 'url' => $url, + 'href' => $url, 'hreflang' => $lang, ]); } diff --git a/tests/MetaTagsTest.php b/tests/MetaTagsTest.php index f90ca8f..9ea56fd 100644 --- a/tests/MetaTagsTest.php +++ b/tests/MetaTagsTest.php @@ -31,11 +31,12 @@ public function testMetaTags() ->mobile('https://m.example.com') ->canonical('https://example.com') ->shortlink('https://git.io/phpseo') - ->amp('https://apm.example.com'); + ->amp('https://apm.example.com') + ->hreflang('es-es', 'https://example.com/es/'); $this->assertNotEmpty((string) $metatags); - $this->assertEquals('PHP SEO', + $this->assertEquals('PHP SEO', str_replace("\n", '', (string)$metatags) );