🐛 Fixed incorrect html title appearing on 'pages' pages (#11358)

closes #11357

- Change that introduced a bug was made in cbca480b97
- The condition could be removed once https://github.com/TryGhost/Ghost/issues/10042 is resolved. It is currently not dependent on the API version rather the object form used in the frontend.
This commit is contained in:
Naz Gargol 2019-11-08 12:58:11 +07:00 committed by GitHub
parent 9a2719ac4f
commit 3f88e7de63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -47,6 +47,14 @@ function getTitle(data, root, options) {
} else {
title = data.post.meta_title || data.post.title;
}
// Page title dependent on legacy object formatting (https://github.com/TryGhost/Ghost/issues/10042)
} else if (_.includes(context, 'page') && data.post) {
if (options && options.property) {
postSdTitle = options.property + '_title';
title = data.post[postSdTitle] || '';
} else {
title = data.post.meta_title || data.post.title;
}
// Page title v2
} else if (_.includes(context, 'page') && data.page) {
if (options && options.property) {

View File

@ -351,7 +351,7 @@ describe('Frontend Routing', function () {
should.not.exist(res.headers['set-cookie']);
should.exist(res.headers.date);
$('title').text().should.equal('Ghost');
$('title').text().should.equal('This is static page');
$('body.page-template').length.should.equal(1);
$('article.post').length.should.equal(1);

View File

@ -61,7 +61,7 @@ describe('{{meta_title}} helper', function () {
it('returns correct title for a page with meta_title set', function () {
var rendered = helpers.meta_title.call(
{page: {title: 'About Page', meta_title: 'All about my awesomeness', page: true}},
{post: {title: 'About Page', meta_title: 'All about my awesomeness', page: true}},
{data: {root: {context: ['page']}}}
);