Еще одна SEO проблема в Друпал которая может расходовать краулинговый бюджет - ссылки "Ответить" в комментариях. По умолчанию конечно они закрыты даже в дефолтном robots.txt Drupal, но мне показалось этого не достаточно так как пауки все равно их краулят, и затем добавляют в Google search console в виде исклеченных из-за блокировки в роботсе.
47000 ссылок на которые поисковый бот потратил свой "бюджет" и которые теперь мозолят мне глаза в консоле. Логичнее добавить к этим ссылкам атрибут "nofollow"
Для этого в функции function comment_links($comment, $node) примерно в строке 1055 и 1078 файла /modules/comment/comment.module.php добавляем:
'attributes' => array('title' => t('reply'), 'rel' => 'nofollow'),
В итоге вид функции должет быть следующим:
function comment_links($comment, $node) {
$links = array();
if ($node->comment == COMMENT_NODE_OPEN) {
if (user_access('administer comments') && user_access('post comments')) {
$links['comment-delete'] = array(
'title' => t('delete'),
'href' => "comment/$comment->cid/delete",
'html' => TRUE,
);
$links['comment-edit'] = array(
'title' => t('edit'),
'href' => "comment/$comment->cid/edit",
'html' => TRUE,
);
$links['comment-reply'] = array(
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid",
'html' => TRUE,
'attributes' => array('title' => t('reply'), 'rel' => 'nofollow'),
);
if ($comment->status == COMMENT_NOT_PUBLISHED) {
$links['comment-approve'] = array(
'title' => t('approve'),
'href' => "comment/$comment->cid/approve",
'html' => TRUE,
'query' => array('token' => drupal_get_token("comment/$comment->cid/approve")),
);
}
}
elseif (user_access('post comments')) {
if (comment_access('edit', $comment)) {
$links['comment-edit'] = array(
'title' => t('edit'),
'href' => "comment/$comment->cid/edit",
'html' => TRUE,
);
}
$links['comment-reply'] = array(
'title' => t('reply'),
'href' => "comment/reply/$comment->nid/$comment->cid",
'html' => TRUE,
'attributes' => array('title' => t('reply'), 'rel' => 'nofollow'),
);
}
else {
$links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
$links['comment_forbidden']['html'] = TRUE;
}
}
return $links;
}
Все, теперь новые reply ссылки не будут пополнять ряды исключенных в Search console
- 32 просмотра