mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Blog icon improvements (#8298)
refs #7688 - renders the correct `/favicon.ico` or `/favcicon.png` in `{{ghost_head}}` - removes an regex issue in `serve-favicon`
This commit is contained in:
parent
a413d70313
commit
4ba5cc862a
8 changed files with 57 additions and 36 deletions
|
@ -8,7 +8,7 @@ var config = require('../../config'),
|
|||
*/
|
||||
function getFaviconUrl() {
|
||||
if (settingsCache.get('icon')) {
|
||||
return utils.url.urlJoin(utils.url.getSubdir(), utils.url.urlFor('image', {image: settingsCache.get('icon')}));
|
||||
return settingsCache.get('icon').match(/\.ico$/i) ? utils.url.urlJoin(utils.url.getSubdir(), '/favicon.ico') : utils.url.urlJoin(utils.url.getSubdir(), '/favicon.png');
|
||||
}
|
||||
|
||||
return utils.url.urlJoin(utils.url.getSubdir(), '/favicon.ico');
|
||||
|
|
|
@ -98,8 +98,9 @@ module.exports = function ghost_head(options) {
|
|||
},
|
||||
blogIcon = settingsCache.get('icon'),
|
||||
// CASE: blog icon is not set in config, we serve the default
|
||||
iconType = !blogIcon ? 'x-icon' : blogIcon.match(/\/favicon\.ico$/i) ? 'x-icon' : 'png',
|
||||
favicon = !blogIcon ? '/favicon.ico' : url.urlFor('image', {image: blogIcon});
|
||||
iconType = !blogIcon ? 'x-icon' : blogIcon.match(/\.ico$/i) ? 'x-icon' : 'png',
|
||||
favicon = !blogIcon ? url.urlFor({relativeUrl: '/favicon.ico'}) :
|
||||
blogIcon.match(/\.ico$/i) ? url.urlFor({relativeUrl: '/favicon.ico'}) : url.urlFor({relativeUrl: '/favicon.png'});
|
||||
|
||||
return Promise.props(fetch).then(function (response) {
|
||||
client = response.client;
|
||||
|
@ -111,7 +112,7 @@ module.exports = function ghost_head(options) {
|
|||
head.push('<meta name="description" content="' + escapeExpression(metaData.metaDescription) + '" />');
|
||||
}
|
||||
|
||||
head.push('<link rel="shortcut icon" href="' + favicon + '" type="' + iconType + '" />');
|
||||
head.push('<link rel="shortcut icon" href="' + favicon + '" type="image/' + iconType + '" />');
|
||||
head.push('<link rel="canonical" href="' +
|
||||
escapeExpression(metaData.canonicalUrl) + '" />');
|
||||
head.push('<meta name="referrer" content="' + referrerPolicy + '" />');
|
||||
|
|
|
@ -51,7 +51,7 @@ function serveFavicon() {
|
|||
storage.getStorage()
|
||||
.read({path: filePath})
|
||||
.then(function readFile(buf) {
|
||||
iconType = settingsCache.get('icon').match(/\/favicon\.ico$/i) ? 'x-icon' : 'png';
|
||||
iconType = settingsCache.get('icon').match(/\.ico$/i) ? 'x-icon' : 'png';
|
||||
content = buildContentResponse(iconType, buf);
|
||||
|
||||
res.writeHead(200, content.headers);
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('getAssetUrl', function () {
|
|||
testUrl.should.equal('/favicon.ico');
|
||||
});
|
||||
|
||||
it.skip('should correct favicon path for custom png', function () {
|
||||
it('should correct favicon path for custom png', function () {
|
||||
sandbox.stub(settingsCache, 'get').withArgs('icon').returns('/content/images/2017/04/my-icon.png');
|
||||
var testUrl = getAssetUrl('favicon.ico');
|
||||
testUrl.should.equal('/favicon.png');
|
||||
|
@ -113,7 +113,7 @@ describe('getAssetUrl', function () {
|
|||
testUrl.should.equal('/blog/favicon.ico');
|
||||
});
|
||||
|
||||
it.skip('should return correct favicon path for custom png', function () {
|
||||
it('should return correct favicon path for custom png', function () {
|
||||
sandbox.stub(settingsCache, 'get').withArgs('icon').returns('/content/images/2017/04/my-icon.png');
|
||||
var testUrl = getAssetUrl('favicon.ico');
|
||||
testUrl.should.equal('/blog/favicon.png');
|
||||
|
|
|
@ -88,6 +88,26 @@ describe('Serve Favicon', function () {
|
|||
middleware(req, res, next);
|
||||
});
|
||||
|
||||
it('custom uploaded myicon.ico', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../test/utils/fixtures/images/');
|
||||
localSettingsCache.icon = 'myicon.ico';
|
||||
|
||||
res = {
|
||||
writeHead: function (statusCode) {
|
||||
statusCode.should.eql(200);
|
||||
},
|
||||
end: function (body) {
|
||||
body.length.should.eql(15086);
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
middleware(req, res, next);
|
||||
});
|
||||
|
||||
it('default favicon.ico', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
|
|
@ -42,14 +42,14 @@ describe('{{asset}} helper', function () {
|
|||
// with png
|
||||
rendered = helpers.asset('favicon.png');
|
||||
should.exist(rendered);
|
||||
String(rendered).should.equal('/content/images/favicon.png');
|
||||
String(rendered).should.equal('/favicon.png');
|
||||
|
||||
localSettingsCache.icon = '/content/images/favicon.ico';
|
||||
|
||||
// with ico
|
||||
rendered = helpers.asset('favicon.ico');
|
||||
should.exist(rendered);
|
||||
String(rendered).should.equal('/content/images/favicon.ico');
|
||||
String(rendered).should.equal('/favicon.ico');
|
||||
});
|
||||
|
||||
it('handles public assets correctly', function () {
|
||||
|
@ -96,14 +96,14 @@ describe('{{asset}} helper', function () {
|
|||
// with png
|
||||
rendered = helpers.asset('favicon.png');
|
||||
should.exist(rendered);
|
||||
String(rendered).should.equal('/blog/content/images/favicon.png');
|
||||
String(rendered).should.equal('/blog/favicon.png');
|
||||
|
||||
localSettingsCache.icon = '/content/images/favicon.ico';
|
||||
|
||||
// with ico
|
||||
rendered = helpers.asset('favicon.ico');
|
||||
should.exist(rendered);
|
||||
String(rendered).should.equal('/blog/content/images/favicon.ico');
|
||||
String(rendered).should.equal('/blog/favicon.ico');
|
||||
});
|
||||
|
||||
it('handles public assets correctly', function () {
|
||||
|
|
|
@ -51,7 +51,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['paged', 'index']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
@ -69,7 +69,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['home', 'index']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="no-referrer-when-downgrade" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -123,7 +123,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['page']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="no-referrer-when-downgrade" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="all about our blog" \/>/);
|
||||
|
@ -171,7 +171,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['tag']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="tag meta description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
|
@ -214,7 +214,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['tag']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="tag description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
|
@ -256,7 +256,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['tag']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description"/);
|
||||
rendered.string.should.not.match(/<meta property="og:description"/);
|
||||
rendered.string.should.not.match(/<meta name="twitter:description"/);
|
||||
|
@ -279,7 +279,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['tag']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="tag meta description" \/>/);
|
||||
|
@ -308,7 +308,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['author']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="Author bio" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
|
@ -360,7 +360,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['paged', 'author']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/author\/AuthorName\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
@ -378,7 +378,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: []}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.9" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
||||
|
@ -416,7 +416,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
re4 = new RegExp('"dateModified": "' + post.updated_at);
|
||||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -496,7 +496,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
re4 = new RegExp('"dateModified": "' + post.updated_at);
|
||||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.not.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -576,7 +576,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
re4 = new RegExp('"dateModified": "' + post.updated_at);
|
||||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog "test" description" \/>/);
|
||||
|
@ -654,7 +654,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
re4 = new RegExp('"dateModified": "' + post.updated_at);
|
||||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -730,7 +730,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
re4 = new RegExp('"dateModified": "' + post.updated_at);
|
||||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -783,7 +783,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['featured']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/featured\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
@ -814,7 +814,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="This is a short post" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="This is a short post" \/>/);
|
||||
|
@ -837,7 +837,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['page']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
@ -857,7 +857,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['index', 'paged'], pagination: {total: 4, page: 3, next: 4, prev: 2}}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/3\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
|
@ -881,7 +881,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['index', 'paged'], pagination: {total: 3, page: 2, next: 3, prev: 1}}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:82832\/" \/>/);
|
||||
|
@ -910,7 +910,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: []}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/content\/images\/favicon.png" type="png" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/blog\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/blog\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/blog\/rss\/" \/>/);
|
||||
|
@ -948,7 +948,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: []}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/content\/images\/favicon.png" type="png" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/blog\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="origin" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: ['post']}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/content\/images\/favicon.png" type="png" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
|
@ -1042,7 +1042,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: []}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/content\/images\/favicon.png" type="png" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
@ -1078,7 +1078,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
{data: {root: {context: []}}}
|
||||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/content\/images\/favicon.png" type="png" \/>/);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
|
|
BIN
core/test/utils/fixtures/images/myicon.ico
Normal file
BIN
core/test/utils/fixtures/images/myicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Add table
Reference in a new issue