Ghost Blog / "Error in required structured data element", GSC Fudged Fix

Just to shut up Google Search Console AMP errors about structured data elements on Ghost 4.0.1

diff -ur out1/core/frontend/meta/schema.js out2/core/frontend/meta/schema.js
--- out1/core/frontend/meta/schema.js	2021-04-16 11:28:51.000000000 +0100
+++ out2/core/frontend/meta/schema.js	2021-04-16 11:31:41.917439989 +0100
@@ -3,6 +3,15 @@
 const socialUrls = require('@tryghost/social-urls');
 const _ = require('lodash');
 
+function schemaImageObjectTryBoth(metaDataVal1, metaDataVal2)
+{
+	var try1 = schemaImageObject(metaDataVal1)
+	if (try1 == null){
+		return schemaImageObject(metaDataVal2);
+	}
+	return try1;
+}
+
 function schemaImageObject(metaDataVal) {
     let imageObject;
     if (!metaDataVal || !metaDataVal.url) {
@@ -92,7 +101,7 @@
         author: {
             '@type': 'Person',
             name: escapeExpression(data[context].primary_author.name),
-            image: schemaImageObject(metaData.authorImage),
+            image: schemaImageObjectTryBoth(metaData.authorImage, metaData.site.logo),
             url: metaData.authorUrl,
             sameAs: trimSameAs(data, context),
             description: data[context].primary_author.metaDescription ?
@@ -103,7 +112,7 @@
         url: metaData.url,
         datePublished: metaData.publishedDate,
         dateModified: metaData.modifiedDate,
-        image: schemaImageObject(metaData.coverImage),
+        image: schemaImageObjectTryBoth(metaData.coverImage,metaData.site.logo),
         keywords: metaData.keywords && metaData.keywords.length > 0 ?
             metaData.keywords.join(', ') : null,
         description: description,

ghost_gsc_error.patch