Exclude Node Title

Provides the option to exclude node titles from display by individual node, content type (bundle), and view mode.

exclude_node_title
26,307 sites
43
drupal.org
Drupal 8 Drupal 9 Drupal 10 Drupal 11

Install

Drupal 11, 10 v2.0.0
composer require 'drupal/exclude_node_title:^2.0'
Drupal 9, 8 v8.x-1.4
composer require 'drupal/exclude_node_title:8.x-1.4'

Overview

Exclude Node Title is a simple yet powerful module that gives site administrators and content editors control over whether node titles are displayed on the front-end of their Drupal site. It addresses a common need in Drupal theming where developers want to hide node titles in certain contexts without modifying template files.

The module offers two primary modes of operation: automatic exclusion for all nodes of a specific content type, or user-defined exclusion where content editors can choose to hide titles on a node-by-node basis via a checkbox on the node edit form. Administrators can configure which view modes (full page, teaser, search results, node form, etc.) should have titles excluded.

The module provides two methods for hiding titles: completely removing the title text from rendering, or adding a CSS class (visually-hidden) to hide the title while keeping it accessible for screen readers. This flexibility allows site builders to choose the approach that best fits their accessibility and SEO requirements.

Features

  • Exclude node titles from display on individual nodes or all nodes of a content type
  • Configure title exclusion per view mode (full page, teaser, search results, node form, and custom view modes)
  • Two rendering modes: complete text removal or CSS-based hiding with visually-hidden class
  • User-defined exclusion with checkbox on node edit form for content editors
  • Option to exclude titles from search result pages (requires Search module)
  • Permission-based access control for excluding titles (own nodes or any node)
  • Display Suite integration for title field display control
  • Automatic cleanup when content types are deleted
  • Support for node preview with title exclusion

Use Cases

Landing pages with custom headers

Create landing pages where the node title is used for administrative purposes but a custom header field or hero section provides the visible page title. Set the content type to 'All nodes' exclusion mode and select 'Full content' view mode.

Portfolio items with visual titles

For portfolio or gallery content where titles are displayed as part of the featured image or in a custom design element, enable 'All nodes' mode to prevent duplicate title display while keeping titles in teasers for listing pages.

Editor-controlled title visibility

Allow content editors to decide on a per-article basis whether to show titles. Configure the content type with 'User defined nodes' mode and grant editors the 'exclude own node title' permission. A checkbox will appear on the node edit form.

Accessible hidden titles

Use the 'Hidden class' rendering type when you want to hide titles visually but keep them available for screen readers and SEO. The visually-hidden class hides content from sighted users while remaining accessible to assistive technologies.

Search result customization

Hide node titles from search results when your search display uses custom result formatting or when titles are redundant with other displayed information. Enable the 'Remove node title from search pages' option.

Node form title hiding

Hide the title display on node edit forms by selecting 'Node form' in the view modes. Useful when using automatic title generation or when the title field has been moved to a different location in the form.

Tips

  • When using 'Hidden class' mode, the title remains in the DOM with a visually-hidden class, which is better for accessibility and SEO than complete removal.
  • The 'Node form' view mode allows hiding titles on edit pages, useful when titles are auto-generated or managed elsewhere in the form.
  • User-defined exclusions are stored in the State API, not configuration, so they are not exported with configuration management.
  • The module adds an 'exclude-node-title' class to the body element of excluded node pages, which can be used for additional CSS targeting.
  • For Display Suite layouts, use the extended node_title field to get proper exclusion support rather than relying on preprocess hooks.

Technical Details

Admin Pages 1
Exclude Node Title /admin/config/content/exclude-node-title

Configure which content types and view modes should have node titles excluded from display. Set global options for search page exclusion and choose the rendering method for hiding titles.

Permissions 3
Administer exclude node title

Allows access to the Exclude Node Title configuration page. This permission has restricted access and should only be granted to trusted administrators.

Exclude any node title

Allows users to exclude titles from any node when editing, regardless of node ownership. The 'Exclude title from display' checkbox will appear on node edit forms for content types configured with 'User defined nodes' mode.

Exclude own node title

Allows users to exclude titles only from nodes they own. The 'Exclude title from display' checkbox will appear on node edit forms for their own content when the content type is configured with 'User defined nodes' mode.

Hooks 12
hook_preprocess_html

Modifies HTML head title and adds exclude-node-title class to body when viewing excluded nodes or their edit forms.

hook_preprocess_page_title

Processes page title variables to hide or remove the title based on configuration.

hook_preprocess_page

Processes page variables to apply title exclusion on full page view and edit forms.

hook_preprocess_node

Processes node template variables to exclude the node label/title based on view mode settings.

hook_preprocess_field

Removes title field content from search results when search exclusion is enabled.

hook_preprocess_search_result

Removes title from search result variables when search exclusion is enabled.

hook_form_node_form_alter

Adds 'Exclude title from display' checkbox to node edit forms for content types with 'user defined' mode, and hides the title field if configured.

hook_node_insert

Saves node exclusion flag when a new node is created with the exclude checkbox checked.

hook_node_update

Updates node exclusion flag when an existing node is saved.

hook_node_delete

Removes deleted nodes from the exclusion list.

hook_ds_fields_info_alter

Overrides Display Suite's node_title field plugin with the module's extended version that respects exclusion settings.

hook_block_view_page_title_block_alter

Hides the page title block for nodes that have title exclusion enabled.

Troubleshooting 5
Title still shows after enabling exclusion

Clear all caches after saving configuration. The module automatically clears caches on save, but manual cache clearing may be needed. Also verify the correct view mode is selected - for full page display, select 'Full content' or 'Default'.

Exclude checkbox not appearing on node edit form

Verify the content type is set to 'User defined nodes' mode (not 'All nodes' or 'None'). Also check that the user has either 'exclude any node title' or 'exclude own node title' permission.

Title hidden in wrong view modes

Review the view mode checkboxes for the content type in the admin settings. Custom view modes from Views or Display Suite need to be explicitly selected.

Search exclusion option is disabled

Enable the core Search module. The search exclusion feature requires Search module to be installed and enabled.

Display Suite title field ignoring exclusion settings

Check the DS field settings for node_title and ensure 'Use Exclude Node Title' is set to 'Yes'. This setting defaults to yes but may have been changed.

Security Notes 2
  • The 'administer exclude node title' permission has restricted access and should only be granted to trusted administrators as it controls site-wide display behavior.
  • Node title exclusion is purely a display feature and does not affect node access or security - titles are still accessible via the API and may appear in other contexts.