Merge pull request #2329 from stenehall/master

Fix for #2328 - Added check for tag for title
This commit is contained in:
Hannah Wolfe 2014-03-04 12:02:09 +00:00
commit a11acff4fd
2 changed files with 13 additions and 1 deletions

View File

@ -461,11 +461,13 @@ coreHelpers.meta_title = function (options) {
blog;
if (_.isString(this.relativeUrl)) {
blog = config.theme();
if (!this.relativeUrl || this.relativeUrl === '/' || this.relativeUrl === '' || this.relativeUrl.match(/\/page/)) {
blog = config.theme();
title = blog.title;
} else if (this.post) {
title = this.post.title;
} else if (this.tag) {
title = this.tag.name + ' - ' + blog.title;
}
}

View File

@ -865,6 +865,16 @@ describe('Core Helpers', function () {
done();
}).then(null, done);
});
it('can return tag name', function (done) {
var post = {relativeUrl: '/tag/foo', tag: {name: 'foo'}};
helpers.meta_title.call(post).then(function (rendered) {
should.exist(rendered);
rendered.string.should.equal('foo - Ghost');
done();
}).then(null, done);
});
});
describe("meta_description helper", function () {