Glossary: Auto-flag Terms in Content

Last modified: January 13, 2008 - 17:17

Glossary helps newbies understand the jargon which always crops up when specialists talk about a topic. Doctors discuss CBC and EKG and CCs. Web developers keep talking about CSS, P2P, XSLT, etc. This can all be intimidating for newbies.

The glossary module scans content for glossary terms (including synonyms). The glossary indicator is inserted after every found term, or the term itself is turned into an indicator, depending on the site settings. By hovering over the indicator, users will see the definition of that term displayed as a "tool tip." Clicking the indicator leads the user to that term presented within the whole glossary or directly to the detailed description of the term, if available.

The glossary uses Drupal's built in taxonomy feature, so you organize your terms in a Drupal vocabulary. This allows you to create hierarchical structures, synonyms, and relations. Glossary terms are represented with the taxonomy terms in the glossary vocabulary. Descriptions are used to provide a short explanation of the terms. You can attach nodes to the terms to provide detailed explanation on the keywords.

Some background

The working part of the Glossary module is an implementation of Drupal's filter mechanism. As such it is not the fastest feature on your site. To help speed it up, there is a separate cache ("cache_filter") to hold content that has already been processed so it need not be done each time that content is displayed.

The module will do its substitution on any node type that uses filters (which is most of them).

The Glossary module will invalidate the filter cache any time a taxonomy term is added to, deleted from, or changed in an associated vocabulary or a setting is changed that would affect the display. You may manually empty the cache_filter table any time you like. Just be aware that there will be a temporary performance impact until the cache is rebuilt. This will, obviously, be more noticeable on a slower server.

Where to Put Terms

The words that are to be flagged by the Glossary module are defined as terms within the "Glossary" vocabulary. You'll find this under "Administer » Content » Categories" (in Drupal 6, "Administer » Content » Taxonomy"). There you will see "Glossary" in the list of vocabularies. Next to it you will see a link to edit it.

You do not need to set up the vocabulary for any content types unless you want to use the "detailed description" (or "full node") method below. You do indicate if the vocabulary is hierarchical (usually not), has related terms, etc. [I recommend that "multi-select," "free-tagging," and "required" be left unselected.]

Usage note: If you choose a hierarchical vocabulary, be aware that the supplied CSS file only supports a depth of three (3) in the display. If your hierarchy is deeper, you should add additional formatting to deal with it.

Next you add terms to the vocabulary. You don't have to get them all at once; you can come back any time and add more.

There is no point in adding a term without a description - that's the whole point of the Glossary module.

Full Node or "Detailed" Descriptions

Glossary runs on a taxonomy vocabulary and its terms. That means that there is a "Glossary" vocabulary to be used on the node types for which you have it set. Hopefully one of those types is either "page" or "story."

This may be a little confusing at first: You should not assign these terms to the nodes that will have the glossary flagged. Those who have done so have noticed that clicking on the indicator takes them to a "taxonomy/term" page for that term - listing all such tagged content.

The only content that should be tagged with the actual glossary terms are the "full node" ("detailed") descriptions. That way clicking on the link takes you to that full-node description. I would assume that the vast majority of the time there will be only one node assigned with those terms.

Issues

As with all contributed modules, when considering submitting an issue:

  1. Read the documentation (two or three times is better).
  2. Review the existing issues list. (Don't forget to select "<all>" for the "Status" field.)
  3. Gather all the appropriate information. This may include (but is not limited to):
    • Drupal version.
    • Browser type and version.
    • Database type and version.
    • Error messages, if any.
    • Module settings.
  4. Submit the issue. If other modules are involved, you may need to submit the issue to those modules as well.
Authors

Originally written by Moshe Weitzman. Much help from killes.
Modified extensively by Al Maw.
Many improvements by Gábor Hojtsy
More improvements by Frodo Looijaard
More improvements by Moshe Weitzman again. And so it goes around ...
Additional fixes and improvements by Nancy Wichmann

Very confusing documentation

shunting - August 22, 2009 - 19:04

From the documentation:

The only content that should be tagged with the actual glossary terms are the "full node" ("detailed") descriptions. That way clicking on the link takes you to that full-node description. I would assume that the vast majority of the time there will be only one node assigned with those terms.

I don't think the assumption that "there will be only one node assigned to these terms" is correct at all.

1. Typically, a Drupal vocabulary term is assigned at the node level only.

2. The mainstream case is to have the same term applied to many nodes, at the node level, and not just one node.

3. What the glossary module does is allow the terms to be embedded in content, which is great.

4. But people should be able to use a vocabulary in a glossary, and get the benefits of the glossary module, without interfering with the mainstream case for terms!

So we have two use cases:

a.) Click on a term link, go to the term collection page, and

b.) Click on a term link, go to the term definition page (which is also the popup in content)

Both use cases need to be handled separately, with case (a) being the mainstream case. What the documentation does is disguise case (a) as case (b), by establishing the convention that there will only be one term on the term collection page, because the term is only applied once, on the node where the term is defined.

Misunderstood

NancyDru - August 23, 2009 - 00:00

I think you have misunderstood the use of Glossary. First, it does not allow you to embed terms in content. It works as a filter and if it finds a word in the content that matches a term, then it inserts a marker so the definition may be displayed. Second, the Glossary vocabulary(ies) are not intended to be a tagging vocabulary, but may be used as such (understanding what happens if you do). For Glossary, the taxonomy is simply a convenient and quick place to store the terms to be used.

Well, from a user perspective...

shunting - August 25, 2009 - 15:24

... a term is a term. Right?

In fact, if the string embedded in the text were a mere string, and not a string meant to represent a term, there wouldn't be a "no gloss" tag to eliminate confusion between strings not intended as terms, and strings that are intended as terms.

Right?

All I'm trying to do is figure out how to address a long-standing desire expressed here, here, and elsewhere, for a behavior that users (including me) feel is quite natural. Whether that be "misunderstanding" or not, I'm not sure...

UPDATE My approach. At least let's allow more than one node to be tagged with the Glossary vocabulary!

 
 

Drupal is a registered trademark of Dries Buytaert.