diff --git a/core/server/data/meta/title.js b/core/server/data/meta/title.js index b4080aee29..600d37e8cf 100644 --- a/core/server/data/meta/title.js +++ b/core/server/data/meta/title.js @@ -12,7 +12,7 @@ function getTitle(data, root, options) { options = options ? options : {}; if (pagination && pagination.total > 1) { - pageString = ' (Page ' + pagination.page + ')'; + pageString = _.has(options.hash, 'page') ? options.hash.page.replace('%', pagination.page) : ' (Page ' + pagination.page + ')'; } // If there's a specific meta title diff --git a/core/server/helpers/meta_title.js b/core/server/helpers/meta_title.js index b27928f90e..2e64210823 100644 --- a/core/server/helpers/meta_title.js +++ b/core/server/helpers/meta_title.js @@ -7,5 +7,5 @@ var proxy = require('./proxy'), // We use the name meta_title to match the helper for consistency: module.exports = function meta_title(options) { // eslint-disable-line camelcase - return getMetaDataTitle(this, options.data.root); + return getMetaDataTitle(this, options.data.root, options); }; diff --git a/core/test/unit/data/meta/title_spec.js b/core/test/unit/data/meta/title_spec.js index 513dbce0d8..9f5eb292a7 100644 --- a/core/test/unit/data/meta/title_spec.js +++ b/core/test/unit/data/meta/title_spec.js @@ -93,6 +93,28 @@ describe('getTitle', function () { title.should.equal('Tag Name - My blog title 3 (Page 39)'); }); + it('should return translated pagination-string if passed in options object', function () { + localSettingsCache.title = 'This is my blog title'; + + var title = getTitle({ + tag: { + name: 'Tag Name' + } + }, { + context: ['tag', 'paged'], + pagination: { + total: 40, + page: 23 + }, + }, { + hash: { + page: ' p.%' + } + }); + + title.should.equal('Tag Name - This is my blog title p.23'); + }); + it('should return tag meta_title if in tag data', function () { var title = getTitle({ tag: {