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:
parent
d638d6e979
commit
8689493cf5
1 changed files with 13 additions and 1 deletions
|
@ -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 ' +
|
||||
|
|
Loading…
Add table
Reference in a new issue