gpreview
Version:
Preview Ghost themes locally without a full Ghost installation
53 lines • 1.76 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bodyClassHelper = bodyClassHelper;
const handlebars_1 = __importDefault(require("handlebars"));
function bodyClassHelper(_options) {
const classes = [];
if ('body_class' in this && this.body_class) {
classes.push(String(this.body_class));
}
if (this.is_home) {
classes.push('home-template');
}
if (this.is_post) {
classes.push('post-template');
if (this.post?.featured) {
classes.push('featured');
}
if (this.post && 'page' in this.post && this.post.page) {
classes.push('page-template');
classes.push(`page-${this.post.slug}`);
}
}
if (this.is_page && this.page) {
classes.push('page-template');
classes.push(`page-${this.page.slug}`);
}
if (this.is_tag && this.tag) {
classes.push('tag-template');
classes.push(`tag-${this.tag.slug}`);
}
if (this.is_author && this.author) {
classes.push('author-template');
classes.push(`author-${this.author.slug}`);
}
if (this.is_404) {
classes.push('error-template');
classes.push('error-404');
}
if (this.is_error) {
classes.push('error-template');
}
if (this.pagination && this.pagination.page > 1) {
classes.push('paged');
}
if (this.post?.custom_template) {
classes.push(`custom-template-${this.post.custom_template}`);
}
return new handlebars_1.default.SafeString(classes.join(' '));
}
//# sourceMappingURL=bodyClass.js.map