From 7ac614030d80a3c172a117f44b7736dec197dba2 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Fri, 17 Apr 2020 12:35:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20structured=20metadata=20?= =?UTF-8?q?for=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #11746 - the original fix[1] inadvertently moved the logo object down one level - this commit moves it back up, and fixes the tests to reflect the expected format [1]: https://github.com/TryGhost/Ghost/commit/3f5daa60c82205b8538a6584b24a9d7ceda593c6 --- core/frontend/meta/schema.js | 5 +--- test/unit/data/meta/schema_spec.js | 47 +++++++++--------------------- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/core/frontend/meta/schema.js b/core/frontend/meta/schema.js index 61c6e58e7b..6c9cbfc555 100644 --- a/core/frontend/meta/schema.js +++ b/core/frontend/meta/schema.js @@ -29,10 +29,7 @@ function schemaPublisherObject(metaDataVal) { '@type': 'Organization', name: escapeExpression(metaDataVal.site.title), url: metaDataVal.site.url || null, - logo: { - '@type': 'ImageObject', - url: schemaImageObject(metaDataVal.site.logo) || null - } + logo: schemaImageObject(metaDataVal.site.logo) || null }; return publisherObject; diff --git a/test/unit/data/meta/schema_spec.js b/test/unit/data/meta/schema_spec.js index 8db88604ac..2be518e096 100644 --- a/test/unit/data/meta/schema_spec.js +++ b/test/unit/data/meta/schema_spec.js @@ -93,12 +93,9 @@ describe('getSchema', function () { url: 'http://mysite.com', logo: { '@type': 'ImageObject', - url: { - '@type': 'ImageObject', - url: 'http://mysite.com/author/image/url/logo.jpg', - width: 500, - height: 500 - } + url: 'http://mysite.com/author/image/url/logo.jpg', + width: 500, + height: 500 } }, url: 'http://mysite.com/post/my-post-slug/' @@ -197,12 +194,9 @@ describe('getSchema', function () { url: 'http://mysite.com', logo: { '@type': 'ImageObject', - url: { - '@type': 'ImageObject', - url: 'http://mysite.com/author/image/url/logo.jpg', - width: 500, - height: 500 - } + url: 'http://mysite.com/author/image/url/logo.jpg', + width: 500, + height: 500 } }, url: 'http://mysite.com/post/my-page-slug/' @@ -304,12 +298,9 @@ describe('getSchema', function () { url: 'http://mysite.com', logo: { '@type': 'ImageObject', - url: { - '@type': 'ImageObject', - url: 'http://mysite.com/author/image/url/logo.jpg', - width: 500, - height: 500 - } + url: 'http://mysite.com/author/image/url/logo.jpg', + width: 500, + height: 500 } }, url: 'http://mysite.com/post/my-amp-post-slug/' @@ -368,10 +359,7 @@ describe('getSchema', function () { '@type': 'Organization', name: 'Site Title', url: null, - logo: { - '@type': 'ImageObject', - url: null - } + logo: null }, url: 'http://mysite.com/post/my-post-slug/' }); @@ -446,10 +434,7 @@ describe('getSchema', function () { '@type': 'Organization', name: 'Site Title', url: 'http://mysite.com', - logo: { - '@type': 'ImageObject', - url: 'http://mysite.com/author/image/url/logo.jpg' - } + logo: 'http://mysite.com/author/image/url/logo.jpg' }, url: 'http://mysite.com/post/my-post-slug/' }); @@ -492,10 +477,7 @@ describe('getSchema', function () { '@type': 'Organization', name: 'Site Title', url: null, - logo: { - '@type': 'ImageObject', - url: null - } + logo: null }, url: 'http://mysite.com/post/my-post-slug/' }); @@ -541,10 +523,7 @@ describe('getSchema', function () { '@type': 'Organization', name: 'Site Title', url: null, - logo: { - '@type': 'ImageObject', - url: null - } + logo: null }, url: 'http://mysite.com/post/my-post-slug/' });