From b8162b15e3e5898a2abc28996bfe2b74b7669850 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 14 Mar 2017 16:50:35 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=F0=9F=90=9B=20Move=20meta=20descri?= =?UTF-8?q?ption=20into=20ghost=20head=20(#8150)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #4424 - meta description is an optional SEO tag that we can provide when we have sensible output - in the cases where we have no useful output, we should not output the tag at all - ghost_head now takes care of this, and themes should not include their own meta description tag --- core/server/helpers/ghost_head.js | 4 +++ .../unit/server_helpers/ghost_head_spec.js | 29 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/core/server/helpers/ghost_head.js b/core/server/helpers/ghost_head.js index db50178d52ae..ebec5a416709 100644 --- a/core/server/helpers/ghost_head.js +++ b/core/server/helpers/ghost_head.js @@ -104,6 +104,10 @@ function ghost_head(options) { if (context) { // head is our main array that holds our meta data + if (metaData.metaDescription && metaData.metaDescription.length > 0) { + head.push(''); + } + head.push(''); head.push(''); diff --git a/core/test/unit/server_helpers/ghost_head_spec.js b/core/test/unit/server_helpers/ghost_head_spec.js index 461ad905ab8b..1ddccc0da286 100644 --- a/core/test/unit/server_helpers/ghost_head_spec.js +++ b/core/test/unit/server_helpers/ghost_head_spec.js @@ -72,6 +72,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.not.match(//); @@ -88,6 +89,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -141,6 +143,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -187,6 +190,7 @@ describe('{{ghost_head}} helper', function () { should.exist(rendered); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -229,6 +233,7 @@ describe('{{ghost_head}} helper', function () { should.exist(rendered); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -269,8 +274,9 @@ describe('{{ghost_head}} helper', function () { ).then(function (rendered) { should.exist(rendered); rendered.string.should.match(//); - rendered.string.should.not.match(//); - rendered.string.should.not.match(//); + rendered.string.should.not.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.not.match(//); @@ -320,6 +327,7 @@ describe('{{ghost_head}} helper', function () { should.exist(rendered); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -368,6 +376,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.not.match(//); @@ -422,6 +431,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -501,6 +511,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.not.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -580,6 +591,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -657,6 +669,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -732,6 +745,7 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); + rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); rendered.string.should.match(//); @@ -791,12 +805,13 @@ describe('{{ghost_head}} helper', function () { rendered.string.should.match(//); rendered.string.should.not.match(/