Using Twig and Views to Create Friendly HTML E-newsletter Code
summary
Shows how a Drupal Views page with hundreds of summaries becomes pasteable email HTML by using Twig templates to output inline styles and table cells, exposing the node with row.nid to create unique anchor IDs, and renaming templates like views-view-field.html.twig in a custom theme with Twig debug on. Covers replacing unsafe characters for ID generation, creating a Constant Contact template that accepts copied elements, and the practical failures: special character encoding and why copy/paste per section is safer than dumping the whole view.
AI-written summary · about
chapters (10)
- 0:00Introduction and background
- 3:18Challenges with inline styles in Views
- 7:00Custom Twig templates explained
- 10:20Rewriting fields with inline styles
- 13:47Handling special characters in emails
- 16:12Creating anchor links in Views
- 19:55Twig variables and resources
- 22:30Twig Tweak module benefits
- 24:12Copying content to Constant Contact
- 25:26Q&A and summary
related talks
37mTalking Twig
44mWhat the frontend? Get the most out of Twig, render arrays and D8's caching
32mAmazing Emails from Drupal 8
29mEmail Templates: The Choose-Your-Own-Adventure
26mVueConf US 2021 | HTML email with Vue.js
11mModern emails using
07mCreating Twig Extensions
34mTemplating - you're doing it wrong
