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:
parent
297b63edce
commit
75f5ab637d
3 changed files with 37 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
const juice = require('juice');
|
const juice = require('juice');
|
||||||
const template = require('./template');
|
const template = require('./template');
|
||||||
|
const config = require('../../../shared/config');
|
||||||
const settingsCache = require('../../services/settings/cache');
|
const settingsCache = require('../../services/settings/cache');
|
||||||
const urlUtils = require('../../../shared/url-utils');
|
const urlUtils = require('../../../shared/url-utils');
|
||||||
const moment = require('moment-timezone');
|
const moment = require('moment-timezone');
|
||||||
|
@ -126,7 +127,8 @@ const serialize = async (postModel, options = {isBrowserPreview: false}) => {
|
||||||
uppercaseHeadings: 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) {
|
if (options.isBrowserPreview) {
|
||||||
const previewUnsubscribeUrl = createUnsubscribeUrl();
|
const previewUnsubscribeUrl = createUnsubscribeUrl();
|
||||||
htmlTemplate = htmlTemplate.replace('%recipient.unsubscribe_url%', previewUnsubscribeUrl);
|
htmlTemplate = htmlTemplate.replace('%recipient.unsubscribe_url%', previewUnsubscribeUrl);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint indent: warn, no-irregular-whitespace: warn */
|
/* eslint indent: warn, no-irregular-whitespace: warn */
|
||||||
module.exports = ({post, site}) => {
|
module.exports = ({post, site, templateConfig}) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
return `<!doctype html>
|
return `<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -819,6 +819,22 @@ figure blockquote p {
|
||||||
border-color: #34495e !important;
|
border-color: #34495e !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
${ templateConfig.showPoweredBy ? `
|
||||||
|
.footer-powered {
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gh-powered {
|
||||||
|
width: 142px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
` : ''}
|
||||||
|
|
||||||
|
/* ----- ENDIF THE BROWSER ----- */
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -846,6 +862,9 @@ figure blockquote p {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="wrapper">
|
<td class="wrapper">
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||||
|
|
||||||
|
|
||||||
|
${ templateConfig.showSiteHeader ? `
|
||||||
<tr>
|
<tr>
|
||||||
<td class="site-info" width="100%" align="center">
|
<td class="site-info" width="100%" align="center">
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
|
@ -860,6 +879,9 @@ figure blockquote p {
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
` : ''}
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="post-title"><a href="${post.url}" class="post-title-link">${post.title}</a></td>
|
<td class="post-title"><a href="${post.url}" class="post-title-link">${post.title}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -901,6 +923,12 @@ figure blockquote p {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="footer">${site.title} © ${date.getFullYear()} – <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
|
<td class="footer">${site.title} © ${date.getFullYear()} – <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
},
|
},
|
||||||
"members": {
|
"members": {
|
||||||
"contentApiAccess": [],
|
"contentApiAccess": [],
|
||||||
"paymentProcessors": []
|
"paymentProcessors": [],
|
||||||
|
"emailTemplate": {
|
||||||
|
"showSiteHeader": true,
|
||||||
|
"showPoweredBy": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"logging": {
|
"logging": {
|
||||||
"level": "info",
|
"level": "info",
|
||||||
|
|
Loading…
Add table
Reference in a new issue