Skip to content

Commit

Permalink
fix: Fixed an issue where the CanonicalLink would render if the `Ro…
Browse files Browse the repository at this point in the history
…bots` tag contained multiple values ([#1378](#1378))
  • Loading branch information
khalwat committed Nov 8, 2023
1 parent a3daa47 commit 7cd91f2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/models/metalink/CanonicalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,8 @@ public function prepForRender(&$data): bool
if ($robots !== null && $robots->include && !Seomatic::$previewingMetaContainers && !Seomatic::$settings->alwaysIncludeCanonicalUrls) {
$robotsArray = $robots->renderAttributes();
$content = $robotsArray['content'] ?? '';
if (!empty($content)) {
if (\is_array($content)) {
if (\in_array('noindex', $content, true) || \in_array('none', $content, true)) {
return false;
}
} else if ($content === 'noindex' || $content === 'none') {
return false;
}
if (str_contains($content, 'noindex') || str_contains($content, 'none')) {
return false;
}
}
// Ensure the href is a full url
Expand Down

0 comments on commit 7cd91f2

Please sign in to comment.