Skip to content

Commit dd3db6a

Browse files
committed
Do not generate canonical URL if location ID does not exist
1 parent 42accf0 commit dd3db6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bundle/Handler/Literal/CanonicalUrl.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function getMetaTags($tagName, array $params = []): array
3737
return [];
3838
}
3939

40+
if ($content->contentInfo->mainLocationId === null) {
41+
return [];
42+
}
43+
4044
$value = $this->urlGenerator->generate(
4145
UrlAliasRouter::URL_ALIAS_ROUTE_NAME,
4246
[

0 commit comments

Comments
 (0)