Merge pull request #3413 from halfdan/3407-meta-title

Correct meta_title for author pages.
This commit is contained in:
Hannah Wolfe 2014-07-27 19:58:50 +01:00
commit 6628127297
2 changed files with 22 additions and 0 deletions

View File

@ -510,6 +510,8 @@ coreHelpers.meta_title = function (options) {
title = this.post.title;
} else if (this.tag) {
title = this.tag.name + ' - ' + blog.title;
} else if (this.author) {
title = this.author.name + ' - ' + blog.title;
}
}

View File

@ -923,6 +923,26 @@ describe('Core Helpers', function () {
}).then(null, done);
});
it('can return title for a tag page', function (done) {
var tag = {relativeUrl: '/tag/rasper-red', tag: {name: 'Rasper Red'}};
helpers.meta_title.call(tag).then(function (rendered) {
should.exist(rendered);
String(rendered).should.equal('Rasper Red - Ghost');
done();
}).then(null, done);
});
it('can return title for an author page', function (done) {
var author = {relativeUrl: '/author/donald', author: {name: 'Donald Duck'}};
helpers.meta_title.call(author).then(function (rendered) {
should.exist(rendered);
String(rendered).should.equal('Donald Duck - Ghost');
done();
}).then(null, done);
});
it('can return escaped title of a post', function (done) {
var post = {relativeUrl: '/nice-escaped-post', post: {title: 'Post Title "</>'}};
helpers.meta_title.call(post).then(function (rendered) {