diff --git a/core/server/helpers/ghost_head.js b/core/server/helpers/ghost_head.js
index bd098be0cb..dd25452424 100644
--- a/core/server/helpers/ghost_head.js
+++ b/core/server/helpers/ghost_head.js
@@ -103,9 +103,11 @@ function ghost_head(options) {
head.push.apply(head, finaliseStructuredData(metaData));
head.push('');
- head.push('\n');
+ if (metaData.schema) {
+ head.push('\n');
+ }
}
if (client && client.id && client.secret) {
diff --git a/core/test/unit/server_helpers/ghost_head_spec.js b/core/test/unit/server_helpers/ghost_head_spec.js
index e2efccba2f..1dc3a610c0 100644
--- a/core/test/unit/server_helpers/ghost_head_spec.js
+++ b/core/test/unit/server_helpers/ghost_head_spec.js
@@ -595,6 +595,26 @@ describe('{{ghost_head}} helper', function () {
}).catch(done);
});
+ it('outputs structured data but not schema for custom channel', function (done) {
+ helpers.ghost_head.call(
+ {safeVersion: '0.3', relativeUrl: '/featured/', context: ['featured']},
+ {data: {root: {context: ['featured']}}}
+ ).then(function (rendered) {
+ 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(//);
+ rendered.string.should.match(//);
+
+ rendered.string.should.not.match(/