From 1cd2fa59bdc964e757c1b2ffd0a13c7a7abc3ba3 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Fri, 25 Jul 2014 19:48:49 +0000 Subject: [PATCH] Correct meta_title for author pages. closes #3407 - Output correct meta_title for author pages - Add test for meta_title for tag and author pages --- core/server/helpers/index.js | 2 ++ core/test/unit/server_helpers_index_spec.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/core/server/helpers/index.js b/core/server/helpers/index.js index 00472f0f27..94dd893db4 100644 --- a/core/server/helpers/index.js +++ b/core/server/helpers/index.js @@ -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; } } diff --git a/core/test/unit/server_helpers_index_spec.js b/core/test/unit/server_helpers_index_spec.js index 7161a596b0..34b8951965 100644 --- a/core/test/unit/server_helpers_index_spec.js +++ b/core/test/unit/server_helpers_index_spec.js @@ -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) {