Hey there. Maybe I'm making this more complicated than it should be, but I can't seem to figure out how to do a one-to-one mapping of a content type to a taxonomy term. Let me explain

  • I have created a simple one-level taxonomy with five terms to function as "main site sections" (e.g. blog, podcasts, etc.). Each of these terms appears in the primary navigation of the site, and the only other taxonomy is a simple free-tagging one for the user to keyword the content.
  • Given the varied nature of the content, there is also five content types. Each of these types corresponds to one of the main site section terms.
  • In the "main site sections" taxonomy, I have to select that each of the five content types must mandatorily have a term from the taxonomy applied to it. However, the user must always choose the same one that relates to the content type. For example, if creating a podcast entry with the podcast content type, the site section must be Podcasts; if creating a blog entry with the blog content type, the site section must be Blog.

This introduces two problems: first, it creates a redundant step for the user to specify the obvious; and second, it allows for the possibility of user error.

I've simplified the description here for communicative sakes. The content types are quite varied between the site sections, so there is no possibility at all to reuse the same content type for different site sections.

Now, is there an easier way to do this, to which I am completely oblivious? I considered using the Node Type Filter, but I understand this still needs taxonomy terms to run the query. Is there a way to set a CCK field to set this automatically, and then hide it from the user? Any thoughts are appreciated.

P

Comments

tm’s picture

asb’s picture

Taxonomy Defaults might be an option; in a sandbox environement it worked quite nicely.

However, I couldn't evaluate with live data it since I get an WSOD when accessing /admin/content/taxonomy/taxonomy_defaults. This module has serious memory issues with largish taxonomies, see Issue queue.

Greetings, -asb

legomski’s picture

tm, thanks for pointing this out to me. It's a bit of a bandage approach, but it helps take care of some things. Much appreciated.

asb’s picture

Hi Paul,

I'm currently trying to solve a very similar problem for a D5 site: I have several content types, and to each of these content types one (ore more) taxonomy terms need to be attached automatically. Users don't understand why they have to create an "artist" (= content type "artist") and then tag it with the term "artist" - users should never be forced to enter redundant data, I know that, Drupal doesn't (yet).

I've been browsing and reading the contributed modules section http://drupal.org/project/Modules/category/71 for several hours; there seems to be no module available for such an simple task; also, there seems to be no possibility to set a default term from a vocabulary (then I could create one vocabulary per content type). The module Node Auto Term (NAT, http://drupal.org/project/nat) sounded promising, but seems to do exactly the opposite of what we need, it creates terms based on a node's title.

Currently, I have to possible appraches to evaluate:

(a) Maybe it is possible with modules like Workflow-NG or one of the Actions/Triggers modules to automate the tagging.

(b) Maybe it is possible to "sidestep" the taxonomy more or less completely with CCK.

(aa) CCK Taxonomy Fields (http://drupal.org/project/cck_taxonomy); this still requires the taxonomy module from core, but allows to disable vocabularies for content types completely, leaving them accessible throught an CCK field. This field provides an option to attach a default setting to each content type. However, there are serious disadvantages (abandoned module, some limitations, heavy inconsistencies).

(bb) Disable taxonomy completely, get similar functionality by a nodereference CCK field pointing to a Panels 2 node that embeds a view (listing etc.) of this pseudo category. Panels 2 as well as views provide menu entries. Depending on your exact case something like this might work, in my case I'm not sure yet.

(c) A third option for someone able to develop a selfmade Drupal module might be to adapt code from modules like Automatic Nodetitles (http://drupal.org/project/auto_nodetitle).

Also, you might want to have a look at the thread "auto taxonomy terms based on CCK field values" which suggests two new modules (http://drupal.org/node/219236).

Greetings, -asb

legomski’s picture

asb, your review of the problem is very thorough. It's unfortunate that you cannot get taxonomy defaults to work on the site, as it does ease the problem somewhat. I'm bothered that it still leaves the possibility for user error. It is also unfortunate that CCK Taxonomy Fields is no longer supported, as this -- conceptually -- would have been the best solution. All I would do is preselect the tax term, and then hide the field.

Ultimately, the best solution would be allow a content retrieval mechanism based on content types and not on taxonomy, or to have the ability to generate a taxonomy on-the-fly, which is based on content types. This would allow navigational items to access those content types directly. But this is not how Drupal is built, though. I'm sure a custom solution is possible, but it's beyond the scope of this project.

Thanks again for your assistance.