Text field with Youtube without cookies
Automatically replaces standard YouTube embed URLs with the privacy-enhanced youtube-nocookie.com domain in supported Drupal text fields when content is saved.
Features
Text field YouTube without cookies automatically changes standard YouTube embed URLs to YouTube's privacy-enhanced domain:
https://www.youtube.com/embed/is replaced with:
https://www.youtube-nocookie.com/embed/The module processes supported text fields when an entity is saved. It supports:
string_longfields.textfields.text_longfields.text_with_summaryfields, including both the main value and the summary.
The following entity types are supported:
- Content nodes.
- Paragraphs.
- Taxonomy terms.
Only the YouTube domain is changed. The video ID, query parameters, and remaining embed markup are preserved.
This module is useful for websites that embed YouTube videos and want to use YouTube's privacy-enhanced domain. It helps prevent YouTube cookies from being set before a visitor interacts with an embedded video.
Post-Installation
After installation, URL replacement is enabled by default. The module adds a configuration page at:
Administration > Configuration > Content > Text field YouTube without cookies
/admin/config/content/text-field-youtube-nocookies
Use this page to enable or disable the replacement functionality.
No new content type, text format, field type, or media type is added. The module works automatically when supported entities are saved.
Existing content is not updated automatically after installation. Existing embed URLs are replaced the next time the corresponding entity is saved.
The module only matches the exact pattern:
src="https://www.youtube.com/embed/Entities saved through command-line operations, such as Drush commands, cron, or migrations, are not processed.
Additional Requirements
This module requires:
- Drupal 10 or Drupal 11.
No contributed modules, external libraries, or third-party services are required.
Recommended modules/libraries
No additional modules or libraries are required.
The module can be used alongside Drupal core's text field and content authoring functionality.
Supporting this Module
There are currently no external funding links for this project. Contributions, testing, documentation improvements, and issue reports are welcome through the Drupal.org project issue queue.
Community Documentation
No additional community documentation or demonstration site is currently available.
For configuration and usage details, see the documentation included with the module.