DRUPAL MODULE / CONTENT & EDITING

Body node ID class

Adds node ID and content type classes to the page body, making individual Drupal content pages easier to style.

What it does.

Body node ID class adds predictable CSS hooks to individual node pages. It exposes both the node’s identifier and its content type on the page body, making targeted styling possible without adding page-specific template logic.

The module restores a behavior familiar from Drupal 7. After enabling it and clearing caches, a theme can target one node through its ID class or apply a shared treatment to every node in the same content type.

Capabilities.

  • A body class for the current node ID
  • A body class for the current content type
  • Page-specific CSS targeting
  • No configuration form required

Using the module.

  1. Enable the module and clear caches.
  2. Use page-node-{nid} or page-node-type-{bundle} selectors in the theme.
Open the official project

Our contribution.

Conceived, designed and implemented the module.

This records WS’s contribution to this community project, alongside its other contributors. View the organization’s supported projects ↗

Original sources.

Your next chapter

The future doesn’t
build itself.

Bring the ambition.
We’ll bring the people, the agents, and the know-how.