Hi there,

Here's the module you requested by email. It adds a menu option "hide_in_sitemap", so you can exclude certain menu items from the sitemap. Let me know what you think.

Regards, Kobus.

CommentFileSizeAuthor
hide_in_sitemap.zip1.9 KBbeljaako
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gjones’s picture

Issue summary: View changes

I made a slight change to your module so that it works in Drupal 7.

/**
 * Override site_map function
 */
function hide_in_sitemap_preprocess_site_map(&$variables) {
  $mids = variable_get('site_map_show_menus', array());
  $output = '';
  if ($mids) {
    foreach ($mids as $mid) {
      $menu = menu_load($mid);
      // Use menu_tree_all_data to retrieve the expanded tree.
      $tree = menu_tree_all_data($mid);
        foreach ($tree as $branch => $value) {
          if ($value["link"]["options"]["hide_in_sitemap"]) {
            unset($tree[$branch]);
        }
      }
      
      if (module_exists('i18nmenu')) {
        i18nmenu_localize_tree($tree);
      }
      $menu_display = _site_map_menu_tree_output($tree);
      $rendered = drupal_render($menu_display);

      if (!empty($menu_display)) {
        $title = $menu['title'];
          $vars = array( 'title' => $title, 
                        'content' => $rendered);
        $output .= theme('site_map_box', $vars);
      }
    }
  }
  $variables["menus"] = $output;
}