gpreview
Version:
Preview Ghost themes locally without a full Ghost installation
33 lines • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.postClassHelper = postClassHelper;
const handlebars_1 = __importDefault(require("handlebars"));
function postClassHelper(options) {
const classes = ['post'];
const post = this.post || this;
if (!post) {
return new handlebars_1.default.SafeString(classes.join(' '));
}
if (post.tags && post.tags.length > 0) {
post.tags.forEach((tag) => {
classes.push(`tag-${tag.slug}`);
});
}
if (post.featured) {
classes.push('featured');
}
if ('page' in post && post.page) {
classes.push('page');
}
if (!post.feature_image) {
classes.push('no-image');
}
if (options.hash?.class) {
classes.push(options.hash.class);
}
return new handlebars_1.default.SafeString(classes.join(' '));
}
//# sourceMappingURL=postClass.js.map