diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx index 650f22318e..d17c98b8d3 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx @@ -101,6 +101,18 @@ const NewsletterPreviewContent: React.FC<{
To: Jamie Larson jamie@example.com
>; } + let subtitleClasses = 'mb-5 text-pretty leading-[1.7] text-black'; + + if (titleFontCategory === 'serif' && bodyFontCategory === 'serif') { + subtitleClasses = clsx(subtitleClasses, 'font-serif text-[1.8rem]'); + } else if (titleFontCategory !== 'serif' && bodyFontCategory === 'serif') { + subtitleClasses = clsx(subtitleClasses, 'text-[1.7rem] tracking-tight'); + } else if (titleFontCategory === 'serif' && bodyFontCategory !== 'serif') { + subtitleClasses = clsx(subtitleClasses, 'font-serif text-[1.8rem]'); + } else { + subtitleClasses = clsx(subtitleClasses, 'text-[1.7rem] tracking-tight'); + } + return (A subtitle to highlight key points and engage your readers
+A subtitle to highlight key points and engage your readers
)}+
By {authorPlaceholder} {currentDate}
-View in browser
+View in browser
This is what your content will look like when you send one of your posts as an email newsletter to your subscribers.
diff --git a/ghost/email-service/lib/EmailRenderer.js b/ghost/email-service/lib/EmailRenderer.js index b7682dc896..797a5a8ffc 100644 --- a/ghost/email-service/lib/EmailRenderer.js +++ b/ghost/email-service/lib/EmailRenderer.js @@ -1017,6 +1017,16 @@ class EmailRenderer { } } + let subtitleFontClass = ''; + const bodyFont = newsletter.get('body_font_category'); + const titleFont = newsletter.get('title_font_category'); + + if (titleFont === 'serif' && bodyFont === 'serif') { + subtitleFontClass = 'post-subtitle-serif-serif'; + } else if (titleFont === 'serif' && bodyFont !== 'serif') { + subtitleFontClass = 'post-subtitle-serif-sans'; + } + const data = { site: { title: this.#settingsCache.get('title'), @@ -1080,7 +1090,7 @@ class EmailRenderer { classes: { title: 'post-title' + (newsletter.get('title_font_category') === 'serif' ? ` post-title-serif` : ``) + (newsletter.get('title_alignment') === 'left' ? ` post-title-left` : ``), titleLink: 'post-title-link' + (newsletter.get('title_alignment') === 'left' ? ` post-title-link-left` : ``), - subtitle: 'post-subtitle' + (newsletter.get('body_font_category') === 'serif' ? ` post-subtitle-serif` : ``) + (newsletter.get('title_alignment') === 'left' ? ` post-subtitle-left` : ``), + subtitle: 'post-subtitle' + ` ` + subtitleFontClass + (newsletter.get('title_alignment') === 'left' ? ` post-subtitle-left` : ``), meta: 'post-meta' + (newsletter.get('title_alignment') === 'left' ? ` post-meta-left` : ` post-meta-center`), body: newsletter.get('body_font_category') === 'sans_serif' ? `post-content-sans-serif` : `post-content` }, diff --git a/ghost/email-service/lib/email-templates/partials/styles-old.hbs b/ghost/email-service/lib/email-templates/partials/styles-old.hbs index 519d1ed6ff..e8af744c1e 100644 --- a/ghost/email-service/lib/email-templates/partials/styles-old.hbs +++ b/ghost/email-service/lib/email-templates/partials/styles-old.hbs @@ -387,13 +387,18 @@ figure blockquote p { padding-bottom: 20px; color: #15212A; font-size: 17px; - line-height: 1.3em; + line-height: 1.6em; text-align: center; } -.post-subtitle-serif { +.post-subtitle-serif-serif { + font-family: Georgia, serif; + font-size: 18px; +} + +.post-subtitle-serif-sans { + font-size: 18px; font-family: Georgia, serif; - letter-spacing: -0.01em; } .post-subtitle-left { diff --git a/ghost/email-service/test/email-renderer.test.js b/ghost/email-service/test/email-renderer.test.js index 7534d7b413..48cee5305b 100644 --- a/ghost/email-service/test/email-renderer.test.js +++ b/ghost/email-service/test/email-renderer.test.js @@ -2073,11 +2073,28 @@ describe('Email renderer', function () { title: 'post-title post-title-serif post-title-left', titleLink: 'post-title-link post-title-link-left', meta: 'post-meta post-meta-left', - subtitle: 'post-subtitle post-subtitle-left', + subtitle: 'post-subtitle post-subtitle-serif-sans post-subtitle-left', body: 'post-content-sans-serif' }); }); + it('has correct subtitle classes for serif title+body', async function () { + const html = ''; + const post = createModel({ + posts_meta: createModel({}), + loaded: ['posts_meta'], + published_at: new Date(0) + }); + const newsletter = createModel({ + title_font_category: 'serif', + title_alignment: 'left', + body_font_category: 'serif', + show_subtitle: true + }); + const data = await emailRenderer.getTemplateData({post, newsletter, html, addPaywall: false}); + assert.equal(data.classes.subtitle, 'post-subtitle post-subtitle-serif-serif post-subtitle-left'); + }); + it('show comment CTA is enabled if labs disabled', async function () { labsEnabled = false; settings.comments_enabled = 'all';