Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Statistics Counter Module statistics_counter crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

Content Like

2 sites No security coverage
View on drupal.org

This module adds a simple AJAX-powered like/unlike feature to content and custom blocks. It tracks likes from both logged-in users and anonymous visitors using cookies, preventing duplicates and allowing administrators to configure where the feature is enabled.

Content Like

Content Like provides a simple AJAX like/unlike feature for Drupal content.
It supports both authenticated users and anonymous visitors.

Features

  • AJAX like/unlike functionality
  • Like count display
  • Supports nodes and custom block content
  • Authenticated users are tracked by Drupal user ID
  • Anonymous users are tracked using a browser cookie
  • Prevents duplicate likes using a database unique key
  • Admin configuration for enabled content types and custom block types
  • Works with default Drupal Twig templates
  • Supports custom Twig templates
  • Lazy builder rendering to reduce cache-related liked-state issues

Configuration

After enabling the module, go to:

/admin/config/content/content-like

From this settings page, site administrators can select which content types
and custom block types should have the like feature enabled.

If a bundle is checked, the like widget is shown when that entity is rendered.
If a bundle is unchecked, the like widget is not shown.

How Authenticated Likes Work

For logged-in users, the module stores the Drupal user ID with the liked entity.
This prevents the same user from repeatedly liking the same content.

How Anonymous Likes Work

For anonymous visitors, the module creates a browser cookie named
content_like_anon_id. The raw cookie value is not stored directly
in the database. Instead, the module stores a hash of the anonymous ID.

This allows anonymous visitors to like and unlike content while reducing
repeated likes from the same browser.

Duplicate Prevention

The module stores likes in a custom database table and uses a unique key on:

  • Entity type
  • Entity ID
  • Liker type
  • Liker ID

This prevents duplicate likes for the same content by the same authenticated
user or anonymous cookie visitor.

Twig Usage

If your theme prints the normal content render array, the like widget appears
automatically:

{{ content }}

If your theme manually prints fields in a custom Twig template, print the
like widget manually:

{% if content.content_like is defined %}
  {{ content.content_like }}
{% endif %}

Requirements

  • Drupal 10 or Drupal 11
  • Node module
  • Block Content module

Permissions

The module provides the following permission:

Administer content like settings

Users with this permission can configure where the like feature is enabled.

Typical Use Cases

  • Blog post likes
  • Article likes
  • Custom block likes
  • Public content engagement tracking

Activity

Tracked releases
2
Tracked since
Jun 2026
Latest release
2 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Jun 23, 2026
1.0.x-dev Dev Jun 23, 2026