2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

🐛Fixed i18n for the {{meta_title}} helper (#9468)

closes #9466

- make 'page' in the meta title translatable through subexpression in the meta title helper
- e.g. `{{meta_title page=(t....)}}`
This commit is contained in:
Mante Bridts 2018-03-19 09:48:07 +01:00 committed by Katharina Irrgang
parent 63aeebb144
commit 7ed822cc0c
3 changed files with 24 additions and 2 deletions

View file

@ -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

View file

@ -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);
};

View file

@ -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: {