Hi all,

is it possible to prevent access or, directly, generation of the taxonomy/term pages?

We use taxonomies to categorize our content, but we do not need the autogenerated taxonomy/term pages generated for each term. Is it possible to avoid them?

Thanks in advance, Simon.

Comments

WorldFallz’s picture

If you don't want the automated listings, why not just use cck fields instead of taxonomy?

SimonVlc’s picture

Truly... I simply didn´t considered it.

In a general way, I understand taxonomies as the drupal system for categorizing content... is it really necessary to mess with cck just to avoid taxonomy term autogenerating pages?

Thanks in advance.

WorldFallz’s picture

no-- you can probably use http://api.drupal.org/api/function/hook_menu_alter to grab the taxonomy/* url and do whatever you want with it (redirect it somewhere, return page not found, etc.).

you can categorize content with either cck or taxonomy-- one of the main reasons to use taxonomy is for the automatic URLs. Otherwise they're just words applied to pages which you can do with cck without having to write code to remove taxonomy urls. imo it just makes more sense (and that's how i do it) but obviously ymmv. Use whatever method you prefer.

SimonVlc’s picture

Thanks for your help WorldFallz, I will definitely try with the hook_menu_alter method to redirect that pages.

Kind regards, Simon.

dlaidig’s picture

did you ever figure this one out? i am trying to do the same thing, but i'm not very familiar with hooks and how to use them. If you figured this one out, can you give me some suggestions to get started? Thanks

carvalhar’s picture

I'd like to have an option to avoid taxonomy indexing, but be able to use it.

anyway, i solved this problem is this hook:

/**
 * Implements hook_init().
 */
function MYMODULE_init() {
  if (defined('MAINTENANCE_MODE')) {
    return;
  }
  if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
    //if you're here it's a taxonomy page, so you'll see 404
    return drupal_not_found();
  }
}

But i'm not sure if this is the best way....

another 'solution' would be hacking hook_menu from taxonomy.module, but hacking drupal's core isn't a good solution.