mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Updated portal to include accent color in preview mode
- If we are in preview mode, we output an additional string to set the accent color for portal - This is semi-temporary, as we will probably have a proper way to pass portal settings later
This commit is contained in:
parent
a0bdba2516
commit
d3b50c8af3
@ -36,12 +36,13 @@ function finaliseStructuredData(meta) {
|
||||
return head;
|
||||
}
|
||||
|
||||
function getMembersHelper() {
|
||||
function getMembersHelper(data) {
|
||||
const stripeDirectSecretKey = settingsCache.get('stripe_secret_key');
|
||||
const stripeDirectPublishableKey = settingsCache.get('stripe_publishable_key');
|
||||
const stripeConnectAccountId = settingsCache.get('stripe_connect_account_id');
|
||||
const colorString = _.has(data, 'site._preview') && data.site.accent_color ? ` data-accent-color="${data.site.accent_color}"` : '';
|
||||
const portalUrl = config.get('portal:url');
|
||||
let membersHelper = `<script defer src="${portalUrl}" data-ghost="${urlUtils.getSiteUrl()}"></script>`;
|
||||
let membersHelper = `<script defer src="${portalUrl}" data-ghost="${urlUtils.getSiteUrl()}"${colorString}></script>`;
|
||||
membersHelper += (`<style> ${templateStyles}</style>`);
|
||||
if ((!!stripeDirectSecretKey && !!stripeDirectPublishableKey) || !!stripeConnectAccountId) {
|
||||
membersHelper += '<script async src="https://js.stripe.com/v3/"></script>';
|
||||
@ -168,7 +169,7 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
|
||||
}
|
||||
|
||||
if (!_.includes(context, 'amp')) {
|
||||
head.push(getMembersHelper());
|
||||
head.push(getMembersHelper(options.data));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user