0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Updated ghost_head to include the members scripts

no-issue

This conditionally adds the members scripts based on the labs setting
for members, and the context of the rendering to NOT be for AMP
This commit is contained in:
Fabien O'Carroll 2019-04-23 16:37:35 +02:00
parent d638d6e979
commit 8689493cf5

View file

@ -13,7 +13,8 @@ var proxy = require('./proxy'),
logging = proxy.logging,
settingsCache = proxy.settingsCache,
config = proxy.config,
blogIconUtils = proxy.blogIcon;
blogIconUtils = proxy.blogIcon,
labs = proxy.labs;
function writeMetaTag(property, content, type) {
type = type || property.substring(0, 7) === 'twitter' ? 'name' : 'property';
@ -54,6 +55,13 @@ function getAjaxHelper(clientId, clientSecret) {
'</script>';
}
function getMembersHelper() {
return `
<script src="${getAssetUrl('public/members-theme-bindings.js')}"></script>
<script defer src="${getAssetUrl('public/members.js')}"></script>
`;
}
/**
* **NOTE**
* Express adds `_locals`, see https://github.com/expressjs/express/blob/4.15.4/lib/response.js#L962.
@ -171,6 +179,10 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
if (client && client.id && client.secret && !_.includes(context, 'amp')) {
head.push(getAjaxHelper(client.id, client.secret));
}
if (!_.includes(context, 'amp') && labs.isSet('members')) {
head.push(getMembersHelper());
}
}
head.push('<meta name="generator" content="Ghost ' +