Skip to content

Commit 7decc9e

Browse files
authored
Merge pull request #57 from butschster/hotfix/53
Fixes problem with generating link hreflang tag
2 parents 92ffaa1 + eb03bd3 commit 7decc9e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/MetaTags/Concerns/ManageLinksTags.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function setHrefLang(string $lang, string $url)
9898
return $this->addLink('alternate_' . $lang, [
9999
'rel' => 'alternate',
100100
'hreflang' => $this->cleanString($lang),
101-
'href' => $this->cleanString($url),
101+
'href' => $url,
102102
]);
103103
}
104104

@@ -129,4 +129,4 @@ public function addLink(string $name, array $attributes)
129129

130130
return $this->addTag($name, Tag::link($attributes));
131131
}
132-
}
132+
}

tests/MetaTags/HrefLangMetaTagsTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ function test_hreflang_should_be_null_if_not_set()
3838
$this->assertNull($this->makeMetaTags()->getHrefLang('en'));
3939
}
4040

41+
function test_query_string()
42+
{
43+
$meta = $this->makeMetaTags()
44+
->setHrefLang('zh-hans', 'https://example.com/?foo=bar&lang=zh-hans');
45+
46+
$this->assertHtmlableEquals(
47+
'<link rel="alternate" hreflang="zh-hans" href="https://example.com/?foo=bar&lang=zh-hans">',
48+
$meta->getHrefLang('zh-hans')
49+
);
50+
}
51+
4152
function test_convert_to_array()
4253
{
4354
$meta = $this->makeMetaTags()

0 commit comments

Comments
 (0)