Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
// # Authors Helper
// Usage: `{{authors}}`, `{{authors separator=' - '}}`
//
// Returns a string of the authors on the post.
// By default, authors are separated by commas.
//
// Note that the standard {{#each authors}} implementation is unaffected by this helper.
const proxy = require('./proxy');
const _ = require('lodash');
const urlService = require('../services/url');
const {SafeString, templates} = proxy;
const ghostHelperUtils = require('@tryghost/helpers').utils;
module.exports = function authors(options = {}) {
options.hash = options.hash || {};
let {
autolink,
separator = ', ',
prefix = '',
suffix = '',
limit,
visibility,
from = 1,
to
} = options.hash;
let output = '';
// # Foreach Helper
// Usage: `{{#foreach data}}{{/foreach}}`
//
// Block helper designed for looping through posts
const _ = require('lodash');
const {logging, i18n, hbs} = require('./proxy');
const {Utils: hbsUtils, handlebars: {createFrame}} = hbs;
const ghostHelperUtils = require('@tryghost/helpers').utils;
module.exports = function foreach(items, options) {
if (!options) {
logging.warn(i18n.t('warnings.helpers.foreach.iteratorNeeded'));
}
if (hbsUtils.isFunction(items)) {
items = items.call(this);
}
// Exclude items which should not be visible in the theme
items = ghostHelperUtils.visibility.filter(items, options.hash.visibility);
// Initial values set based on parameters sent through. If nothing sent, set to defaults
const {fn, inverse, hash, data, ids} = options;
let {columns, limit, from, to} = hash;
// # Tags Helper
// Usage: `{{tags}}`, `{{tags separator=' - '}}`
//
// Returns a string of the tags on the post.
// By default, tags are separated by commas.
//
// Note that the standard {{#each tags}} implementation is unaffected by this helper
const proxy = require('./proxy');
const _ = require('lodash');
const ghostHelperUtils = require('@tryghost/helpers').utils;
const urlService = proxy.urlService;
const SafeString = proxy.SafeString;
const templates = proxy.templates;
module.exports = function tags(options) {
options = options || {};
options.hash = options.hash || {};
const autolink = !(_.isString(options.hash.autolink) && options.hash.autolink === 'false'),
separator = _.isString(options.hash.separator) ? options.hash.separator : ', ',
prefix = _.isString(options.hash.prefix) ? options.hash.prefix : '',
suffix = _.isString(options.hash.suffix) ? options.hash.suffix : '',
limit = options.hash.limit ? parseInt(options.hash.limit, 10) : undefined;
let output = '',
'use strict';
// # Authors Helper
// Usage: `{{authors}}`, `{{authors separator=' - '}}`
//
// Returns a string of the authors on the post.
// By default, authors are separated by commas.
//
// Note that the standard {{#each authors}} implementation is unaffected by this helper.
const proxy = require('./proxy');
const _ = require('lodash');
const urlService = require('../services/url');
const {SafeString, templates} = proxy;
const ghostHelperUtils = require('@tryghost/helpers').utils;
module.exports = function authors(options = {}) {
options.hash = options.hash || {};
let {
autolink,
separator = ', ',
prefix = '',
suffix = '',
limit,
visibility,
from = 1,
to
} = options.hash;
let output = '';
// # Foreach Helper
// Usage: `{{#foreach data}}{{/foreach}}`
//
// Block helper designed for looping through posts
const _ = require('lodash');
const {logging, i18n, hbs} = require('./proxy');
const {Utils: hbsUtils, handlebars: {createFrame}} = hbs;
const ghostHelperUtils = require('@tryghost/helpers').utils;
module.exports = function foreach(items, options) {
if (!options) {
logging.warn(i18n.t('warnings.helpers.foreach.iteratorNeeded'));
}
if (hbsUtils.isFunction(items)) {
items = items.call(this);
}
// Exclude items which should not be visible in the theme
items = ghostHelperUtils.visibility.filter(items, options.hash.visibility);
// Initial values set based on parameters sent through. If nothing sent, set to defaults
const {fn, inverse, hash, data, ids} = options;
let {columns, limit, from, to} = hash;
const ghostHelperUtils = require('@tryghost/helpers').utils;
function getKeywords(data) {
if (data.post && data.post.tags && data.post.tags.length > 0) {
return ghostHelperUtils.visibility.filter(data.post.tags, ['public'], function processItem(item) {
return item.name;
});
}
return null;
}
module.exports = getKeywords;