🐛 Fixed Twittercard having wrong property when no feature image provided

closes #10706

- Fixed a bug where we weren't assigning `summary_large_image` as Twitter card property when no feature image is provided, but a dedicated Twitter image
- Updated test to reflect this case to be tested better
This commit is contained in:
Aileen Nowak 2019-05-06 11:51:44 +08:00 committed by Naz Gargol
parent 4563999352
commit 79345f9030
2 changed files with 2 additions and 9 deletions

View File

@ -4,7 +4,7 @@ function getStructuredData(metaData) {
var structuredData,
card = 'summary';
if (metaData.coverImage.url) {
if (metaData.twitterImage || metaData.coverImage.url) {
card = 'summary_large_image';
}

View File

@ -65,7 +65,7 @@ describe('getStructuredData', function () {
done();
});
it('should return structured data from metadata with provided og and twitter images per post', function (done) {
it('should return structured data from metadata with provided og and twitter images only per post', function (done) {
var metadata = {
blog: {
title: 'Blog Title',
@ -78,13 +78,6 @@ describe('getStructuredData', function () {
canonicalUrl: 'http://mysite.com/post/my-post-slug/',
publishedDate: '2015-12-25T05:35:01.234Z',
modifiedDate: '2016-01-21T22:13:05.412Z',
coverImage: {
url: 'http://mysite.com/content/image/mypostcoverimage.jpg',
dimensions: {
width: 500,
height: 500
}
},
ogImage: {
url: 'http://mysite.com/content/image/mypostogimage.jpg',
dimensions: {