mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Use tag as title on tag pages
closes #2328 - added check for tag in coreHelpers.meta_title and use if set - added test for correct title on tag pages Rewritting to tag - blogtitle based on comments from PR
This commit is contained in:
parent
be8b9cf092
commit
825ba4fb82
@ -461,11 +461,13 @@ coreHelpers.meta_title = function (options) {
|
||||
blog;
|
||||
|
||||
if (_.isString(this.relativeUrl)) {
|
||||
blog = config.theme();
|
||||
if (!this.relativeUrl || this.relativeUrl === '/' || this.relativeUrl === '' || this.relativeUrl.match(/\/page/)) {
|
||||
blog = config.theme();
|
||||
title = blog.title;
|
||||
} else if (this.post) {
|
||||
title = this.post.title;
|
||||
} else if (this.tag) {
|
||||
title = this.tag.name + ' - ' + blog.title;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -865,6 +865,16 @@ describe('Core Helpers', function () {
|
||||
done();
|
||||
}).then(null, done);
|
||||
});
|
||||
|
||||
it('can return tag name', function (done) {
|
||||
var post = {relativeUrl: '/tag/foo', tag: {name: 'foo'}};
|
||||
helpers.meta_title.call(post).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.equal('foo - Ghost');
|
||||
|
||||
done();
|
||||
}).then(null, done);
|
||||
});
|
||||
});
|
||||
|
||||
describe("meta_description helper", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user