🐛 Fixed structured metadata for images

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]: 3f5daa60c8
This commit is contained in:
Daniel Lockyer 2020-04-17 12:35:18 +01:00
parent 7104183c6f
commit 7ac614030d
2 changed files with 14 additions and 38 deletions

View File

@ -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;

View File

@ -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/'
});