Drupal 7 og SEO

H

Fjern meta elementer i header

<?php
function THEME_html_head_alter(&$head_elements) {
    unset(
$head_elements['system_meta_generator']);
    foreach (
$head_elements as $key => $element) {
        if (isset(
$element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
          unset(
$head_elements[$key]);
        }
        if (isset(
$element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
          unset(
$head_elements[$key]);
        }
    }
}
?>

U

Undgå at /user sider bliver indekseret

- template.php

<?php
$url_parts
= explode('/', request_uri());
  if (
$url_parts[1] == 'user') {
   
$elements = array(
     
'#tag' => 'meta',
     
'#attributes' => array(
       
'name' => 'robots',
       
'content' => 'noindex,nofollow',
      ),
    );
  
drupal_add_html_head($elements, 'robots');
  }
?>

M

Hvilke moduler skal der bruges

https://www.drupal.org/project/globalredirect
https://www.drupal.org/project/metatag