- Issue created by @fromme
It is wrong logic in noindex_metatag_page_attachments (noindex_metatag.module):
foreach ($val as $meta) {
if (isset($meta['#attributes']['name']) && ($meta['#attributes']['name'] == 'robots')) {
$attachments['#attached']['html_head'][$key][0]['#attributes']['content'] = 'noindex';
}
else {
$robots = [
'#tag' => 'meta',
'#attributes' => [
'name' => 'robots',
'content' => 'noindex',
],
];
$attachments['#attached']['html_head'][] = [$robots, 'robots'];
}
}
Everytime when logic isset($meta['#attributes']['name']) && ($meta['#attributes']['name'] == 'robots')
false you add new meta-tag. But it should be done only once after you check all array $attachments['#attached']['html_head'].
It is better to use flag to fix and reduce the code.
Active
1.0
Code