0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added minor member newsletter customisations via config

no issue
- adds a `members:emailTemplate` config object
  - `showSiteHeader` - defaults to `true`, shows the site title and icon in member emails
  - `showPoweredBy` - defaults to `false`, adds a "Publish with Ghost" button to member email footer
- updates member newsletter email template with hideable site header and "powered by" badge
This commit is contained in:
Peter Zimon 2020-08-20 17:14:43 +02:00 committed by Kevin Ansfield
parent 297b63edce
commit 75f5ab637d
3 changed files with 37 additions and 3 deletions

View file

@ -1,5 +1,6 @@
const juice = require('juice');
const template = require('./template');
const config = require('../../../shared/config');
const settingsCache = require('../../services/settings/cache');
const urlUtils = require('../../../shared/url-utils');
const moment = require('moment-timezone');
@ -126,7 +127,8 @@ const serialize = async (postModel, options = {isBrowserPreview: false}) => {
uppercaseHeadings: false
});
let htmlTemplate = template({post, site: getSite()});
const templateConfig = config.get('members:emailTemplate');
let htmlTemplate = template({post, site: getSite(), templateConfig});
if (options.isBrowserPreview) {
const previewUnsubscribeUrl = createUnsubscribeUrl();
htmlTemplate = htmlTemplate.replace('%recipient.unsubscribe_url%', previewUnsubscribeUrl);

View file

@ -1,5 +1,5 @@
/* eslint indent: warn, no-irregular-whitespace: warn */
module.exports = ({post, site}) => {
module.exports = ({post, site, templateConfig}) => {
const date = new Date();
return `<!doctype html>
<html>
@ -819,6 +819,22 @@ figure blockquote p {
border-color: #34495e !important;
}
}
${ templateConfig.showPoweredBy ? `
.footer-powered {
text-align: center;
padding-bottom: 40px;
}
.gh-powered {
width: 142px;
height: 30px;
}
` : ''}
/* ----- ENDIF THE BROWSER ----- */
</style>
</head>
@ -846,6 +862,9 @@ figure blockquote p {
<tr>
<td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
${ templateConfig.showSiteHeader ? `
<tr>
<td class="site-info" width="100%" align="center">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
@ -860,6 +879,9 @@ figure blockquote p {
</table>
</td>
</tr>
` : ''}
<tr>
<td class="post-title"><a href="${post.url}" class="post-title-link">${post.title}</a></td>
</tr>
@ -901,6 +923,12 @@ figure blockquote p {
<tr>
<td class="footer">${site.title} &copy; ${date.getFullYear()} <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
</tr>
${ templateConfig.showPoweredBy ? `
<tr>
<td class="footer-powered"><a href="https://ghost.org/"><img src="https://static.ghost.org/v3.0.0/images/powered.png" border="0" width="142" height="30" class="gh-powered" alt="Publish with Ghost"></a></td>
</tr>
` : '' }
</table>
</td>
</tr>

View file

@ -30,7 +30,11 @@
},
"members": {
"contentApiAccess": [],
"paymentProcessors": []
"paymentProcessors": [],
"emailTemplate": {
"showSiteHeader": true,
"showPoweredBy": false
}
},
"logging": {
"level": "info",