gated_contents
Gated Content lets you restrict pages and protect individual nodes with passwords for anonymous (not logged-in) visitors. Block specific URLs, entire content types, or lock a single node behind a password — all without writing any code.
Features
- Blacklist specific paths or wildcard patterns (e.g.
/resources/*) so anonymous users cannot access them - Gate entire content types — every node of a selected type is automatically restricted
- Choose what happens to blocked visitors: redirect to the standard 403 Access Denied page, or send them to any custom URL (e.g. a login or subscription page)
- Set a password on any individual node regardless of content type, directly from the node edit form
- Session-based unlock — once a visitor enters the correct password they can revisit the node freely for the rest of their browser session
- Bypass permission (Bypass node password) lets editors and administrators view protected nodes without entering a password
- Works with any content type out of the box — no additional field configuration required
- Compatible with Drupal 10 and 11
This module is ideal for membership sites, film festivals, event portals, or any site that needs lightweight gating without a full-blown paywall or access control system.
Post-Installation
After enabling the module, run drush cr to rebuild the cache. The base field that stores the per-node password is registered automatically on install.
Path & node-type blacklisting: Go to Administration → Configuration → Content → Gated Content (/admin/config/content/gated-content). Enter the paths you want to block (one per line, wildcards supported), check any content types to gate, and choose whether blocked visitors are sent to the 403 page or a custom URL.
Per-node passwords: Open any node in edit mode. You will find a new Password protection panel in the sidebar. Enter a password in the field and save the node. Anonymous visitors will now be prompted for that password before they can view the page. Leave the field blank to remove the gate.
Grant the Bypass node password permission to any role (e.g. Editor, Administrator) that should be able to view protected nodes without entering a password.
Additional Requirements
This module has no dependencies beyond Drupal core. The only core module required is Node, which is enabled by default in every Drupal installation.
Recommended modules/libraries
- Redirect — if you want to build more sophisticated redirect rules on top of the basic gating this module provides.
- Login Destination — useful for sending anonymous users to a specific page after they log in, complementing the path blacklist feature.
Similar projects
- Content Access — provides role-based access control per node or content type. More powerful but also more complex; does not support per-node passwords or path-based redirects.
- Node Access Password — similar per-node password concept but targets older Drupal versions. Gated Content is built for Drupal 10/11 with modern APIs (event subscribers, base fields, config schema).
- Restrict by IP — restricts access by IP address rather than by user role or password.
Gated Content is intentionally lightweight: it covers the most common gating scenarios (path blacklisting, content-type gating, and per-node passwords) with zero dependencies and minimal configuration.
Supporting this Module
If you find this module useful, please consider leaving a review on drupal.org or filing detailed bug reports to help improve it. Pull requests and patches are welcome via the issue queue.