diff --git a/core/server/helpers/index.js b/core/server/helpers/index.js index 9a416c40c9..295200ea49 100644 --- a/core/server/helpers/index.js +++ b/core/server/helpers/index.js @@ -136,7 +136,9 @@ coreHelpers = function (ghost) { ghost.registerThemeHelper('body_class', function (options) { var classes = []; - if (!this.path || this.path === '/' || this.path === '') { + if (_.isString(this.path) && this.path.match(/\/page/)) { + classes.push('archive-template'); + } else if (!this.path || this.path === '/' || this.path === '') { classes.push('home-template'); } else { classes.push('post-template'); diff --git a/core/test/unit/server_helpers_index_spec.js b/core/test/unit/server_helpers_index_spec.js index 4e36118eb8..4097954e51 100644 --- a/core/test/unit/server_helpers_index_spec.js +++ b/core/test/unit/server_helpers_index_spec.js @@ -154,13 +154,16 @@ describe('Core Helpers', function () { it('can render class string for context', function () { var rendered1 = handlebars.helpers.body_class.call({path: '/'}), - rendered2 = handlebars.helpers.body_class.call({path: '/a-post-title'}); + rendered2 = handlebars.helpers.body_class.call({path: '/a-post-title'}), + rendered3 = handlebars.helpers.body_class.call({path: '/page/4'}); should.exist(rendered1); should.exist(rendered2); + should.exist(rendered3); rendered1.string.should.equal('home-template'); rendered2.string.should.equal('post-template'); + rendered3.string.should.equal('archive-template'); }); });