Glossify

Provides text filters that automatically scan content and create links or tooltips based on existing entity labels (taxonomy terms, nodes, or commerce products).

glossify
1,220 sites
35
drupal.org

Install

Drupal 11, 10 v3.1.3
composer require 'drupal/glossify:^3.1'
Drupal 9, 8 v3.0.6
composer require 'drupal/glossify:^3.0'

Overview

Glossify is a powerful text processing module that automatically identifies and enhances terms within your content by converting them into links or tooltips. When content is displayed, the module scans the text for matches against entity labels from your site's taxonomy vocabularies, node titles, or commerce product names.

The module provides a flexible base API that three submodules extend: Glossify Taxonomy for linking to taxonomy term pages, Glossify Node for linking to content pages, and Glossify Commerce for linking to product pages. Each filter can be configured independently on any text format, allowing fine-grained control over which content gets processed and how matches are displayed.

Key capabilities include case-sensitive or case-insensitive matching, first-match-only or all-matches processing, synonyms support through custom text fields, customizable URL patterns, selective HTML tag exclusion, and the ability to exclude specific text using CSS classes. Advanced users can also alter the underlying database queries using Drupal hooks.

Features

  • Automatic text scanning and term matching - Scans content for matches against entity labels (taxonomy terms, node titles, or product names) and automatically wraps them in links or tooltips
  • Three display modes - Show matches as HTML5 tooltips only (abbr element), links only (anchor element), or both tooltips and links combined
  • Case sensitivity control - Configure whether matching is case-sensitive or case-insensitive for each filter independently
  • First match only option - Choose to link/tooltip only the first occurrence of each term or process all occurrences throughout the content
  • Synonyms support - Match not only the entity label but also values from a designated text field containing synonyms (supports multi-value fields)
  • Customizable URL patterns - Define custom URL patterns using [id] as a token placeholder for entity IDs (e.g., /glossary/[id] or /taxonomy/term/[id])
  • HTML tag exclusion - Specify comma-separated HTML tags to ignore during processing (e.g., h1, h2, strong) to prevent matching in headlines or emphasized text
  • CSS class exclusion - Wrap text in an element with 'glossify-exclude' class to prevent specific instances from being processed
  • Tooltip truncation - Optionally truncate tooltip text to 300 characters for cleaner display
  • Query alteration hooks - Developers can use hook_query_TAG_alter() to modify the entity selection query for advanced filtering and customization
  • Multi-language support - Filters respect content language and only match entities in the current language
  • Intelligent matching boundaries - Only matches complete words bounded by whitespace or punctuation, not partial word matches
  • Cache tag management - Proper cache invalidation when source entities are updated
  • UTF-8 and special character support - Full support for international characters including multi-byte UTF-8 sequences

Use Cases

Building a glossary for technical documentation

Create a 'Glossary' taxonomy vocabulary with terms and descriptions for technical jargon. Enable the Glossify Taxonomy filter on your documentation text format. Configure it to show tooltips with links, select the Glossary vocabulary, and enable first-match-only. Now any technical terms appearing in your documentation will automatically display their definitions as tooltips and link to detailed glossary pages.

Automatic internal linking for SEO

Select specific content types as sources in the Glossify Node filter to automatically create internal links whenever those content titles appear in other articles. This improves site navigation and SEO by creating a natural internal linking structure without manual effort.

Product catalog cross-referencing

For e-commerce sites using Drupal Commerce, enable Glossify Commerce to automatically link product names mentioned in blog posts, category descriptions, or other content directly to product pages, improving product discoverability and user experience.

Medical or legal term definitions

Create a vocabulary of medical or legal terms with plain-language descriptions. Visitors can hover over highlighted terms to see explanations without leaving the page, making complex content more accessible.

Multi-language glossary support

Glossify respects content language, so translated terms will only match content in the same language. Create term translations in your vocabulary to provide language-appropriate glossification across multilingual sites.

Using synonyms for flexible matching

Add a multi-value text field to your vocabulary or content type to store synonyms. Configure the filter to use this field, so both the main term and all synonyms will trigger tooltips/links. For example, 'Drupal CMS', 'Drupal', and 'D10' can all link to the same Drupal term page.

Tips

  • Place Glossify filters after HTML-correcting filters but before other text transformation filters for best results
  • Use the filter weight to control processing order if you have multiple text filters enabled
  • For performance on sites with many terms, consider enabling 'First match only' to reduce processing overhead
  • Create a dedicated 'Glossary' view to display all terms from your vocabulary with descriptions
  • Use the URL pattern setting to link to custom paths like /glossary/[id] instead of default entity paths
  • Combine with CSS styling to make tooltips and links visually distinctive (target .glossify-tooltip-tip and .glossify-tooltip-link classes)
  • The tip_raw template variable preserves HTML for custom template implementations that can safely render formatted content

Technical Details

Admin Pages 1
Text format configuration /admin/config/content/formats/manage/{filter_format}

Configure Glossify filters within any text format's settings. Enable the filter and access its configuration options under 'Filter settings' section.

Hooks 4
hook_query_glossify_taxonomy_tooltip_alter

Alter the database query that fetches taxonomy terms for the glossify_taxonomy filter. Allows adding conditions, joins, or expressions to include or exclude specific terms.

hook_query_glossify_node_tooltip_alter

Alter the database query that fetches nodes for the glossify_node filter. Allows filtering nodes based on custom criteria.

hook_query_glossify_commerce_product_tooltip_alter

Alter the database query that fetches commerce products for the glossify_commerce_product filter.

hook_glossify_taxonomy_vocabs_alter

Alter the list of vocabulary machine names used by the glossify_taxonomy filter before processing.

Troubleshooting 6
Terms are not being matched in content

Verify that: 1) The filter is enabled on the text format used for the content, 2) At least one vocabulary/content type is selected in filter settings, 3) The source entity is published and in the correct language, 4) Case sensitivity settings match your content, 5) The term appears as a complete word (not part of another word).

Same term is being linked multiple times

Enable the 'First match only' option in the filter settings to process only the first occurrence of each term per field.

Terms in headings or other elements are being matched

Add the tag names to the 'Ignore tags' setting (e.g., h1,h2,h3,strong) to prevent matching within those elements.

Need to exclude a specific term instance

Wrap the text in a span or other element with class 'glossify-exclude': <span class="glossify-exclude">Term</span>. Configure CKEditor's Style plugin to make this easy for editors.

Synonyms field not working

Ensure the synonyms field: 1) Is a Text (plain) field type, 2) Exists on all selected vocabularies/content types, 3) Has values saved for the entities you want to match.

Changes to terms not reflected in content

Clear the Drupal cache. Glossify uses cache tags to invalidate when entities change, but manual cache clearing may be needed in some cases.