Unified email wrapper for welcome and newsletter emails#26898
Unified email wrapper for welcome and newsletter emails#26898
Conversation
WalkthroughThis pull request extracts shared email CSS and the HTML wrapper into Handlebars partials. It adds 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/core/core/server/services/email-rendering/partials/email-wrapper.hbs (1)
40-46: Consider adding alt attribute for header image accessibility.The header image
<img>tag lacks analtattribute. While this may be decorative, adding a meaningful alt (or empty alt for decorative images) improves email accessibility.♻️ Suggested improvement
<a href="{{site.url}}"> <img src="{{headerImage}}" {{`#if` headerImageWidth}} width="{{headerImageWidth}}" {{/if}} + alt="{{site.title}}" > </a>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/core/core/server/services/email-rendering/partials/email-wrapper.hbs` around lines 40 - 46, The <img> tag rendering the header image (using the headerImage and optional headerImageWidth) is missing an alt attribute; update the email-wrapper.hbs partial so the image includes an alt attribute, e.g. alt="{{headerImageAlt}}" and fall back to an empty alt (alt="") when no descriptive text is provided so decorative images remain accessible; ensure you reference the existing variables (headerImage, headerImageWidth, headerImageAlt) and keep the fallback behavior consistent with how other image fields are handled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/core/core/server/services/email-rendering/partials/email-wrapper.hbs`:
- Around line 40-46: The <img> tag rendering the header image (using the
headerImage and optional headerImageWidth) is missing an alt attribute; update
the email-wrapper.hbs partial so the image includes an alt attribute, e.g.
alt="{{headerImageAlt}}" and fall back to an empty alt (alt="") when no
descriptive text is provided so decorative images remain accessible; ensure you
reference the existing variables (headerImage, headerImageWidth, headerImageAlt)
and keep the fallback behavior consistent with how other image fields are
handled.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dd0f2ce9-b0dc-4f1f-9184-110d77373466
📒 Files selected for processing (7)
ghost/core/core/server/services/email-rendering/partials/base-styles.hbsghost/core/core/server/services/email-rendering/partials/email-wrapper.hbsghost/core/core/server/services/email-service/email-renderer.jsghost/core/core/server/services/email-service/email-templates/partials/styles.hbsghost/core/core/server/services/email-service/email-templates/template.hbsghost/core/core/server/services/member-welcome-emails/email-templates/wrapper.hbsghost/core/core/server/services/member-welcome-emails/member-welcome-email-renderer.js
ref https://linear.app/ghost/issue/NY-1168/
Ideally, we can use the same wrapper for all emailed content, leaving it to the consumer to adjust anything specific to the use case. This is a safer way to use the same styles to maintain behavior, and each 'component' (e.g. post header) should handle its own, compartmentalized behavior to not disrupt the whole.
Transactional emails like the magic link do not use this currently, though it could be brought into this as we add further email customization options.