next_custom_tags
4 sites
No security coverage
Next Custom Tags provides fine-grained control over Next.js tag-based caching by allowing developers to define custom cache tag plugins for any Drupal entity type.
Implement complex, targeted caching strategies without full site rebuilds. When content changes, the module automatically extracts the relevant tags and revalidates only the affected pages in your Next.js frontend.
Key Features
- Entity-Agnostic Plugin System: Create plugins for Nodes, Blocks, Menus, Webforms, custom entities, or any other entity type.
- Automatic Revalidation: When entities are created, updated, or deleted, enabled plugins extract tags and trigger a revalidation request to your Next.js frontend.
- Manual Control: A dedicated interface to manually revalidate specific tags on demand.
- Custom Tag Definitions: Define tags that live outside of entities (e.g., global settings tags) for manual management.
- Developer Visibility: The settings form shows example tags generated by each plugin, so you can verify exactly what is sent to Next.js.
- Configurable Revalidate URL: Uses the revalidate URL from your Next.js site configuration, with a sensible fallback.
How It Works
- Configure: Enable plugins for the entity types you want to track.
- Edit Content: When an editor saves an entity, the module invokes the relevant plugin.
- Extract: The plugin generates cache tags based on any logic you define — not just entity IDs. Create arbitrary tags matching your frontend components (e.g.,
collection:featured,menu:main-footer, ortaxonomy:term:123). - Revalidate: The module sends a revalidation request to your Next.js site for those specific tags, keeping your frontend up-to-date without rebuilding the entire site.
Configuration & Usage
The module provides three administrative interfaces:
-
Plugin Configuration:
/admin/config/services/next-custom-tags/plugin-settings
Enable or disable plugins per Next.js site, view example tags, and configure manual revalidation options. -
Manual Revalidation:
/admin/config/services/next-custom-tags/revalidate
Manually trigger revalidation for specific tags when needed. -
Custom Tag Definitions:
/admin/config/services/next-custom-tags/custom-tags
Register tags that are not automatically extracted from entities but may need manual revalidation.
Included Submodules
- Next Custom Tags - Block (
next_custom_tags_block): Cache tag extraction for Block Content entities. - Next Custom Tags - Menu (
next_custom_tags_menu): Cache tag extraction for Menu Link Content entities, ensuring navigation updates immediately when menu links change. - Next Custom Tags - Webform (
next_custom_tags_webform): Cache tag extraction for Webform entities.
Requirements
- Drupal: Compatible with Drupal 10 and 11.
- Dependencies: Next.js module