Skip to content

Commit ff330d3

Browse files
committed
Ensure OpenGraph and structured data receive an array for images, preventing undefined parsing.
1 parent c92b2f3 commit ff330d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

themes/icarus/layout/common/head.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ module.exports = class extends Component {
105105
}
106106

107107
// Only pass images prop to OpenGraph when we actually have images.
108+
// Ensure we pass an array (possibly empty) to OpenGraph so the component
109+
// never receives undefined and attempts to parse it.
108110
const openGraphImagesProp = (Array.isArray(openGraphImages) && openGraphImages.length) || typeof openGraphImages === 'string'
109111
? openGraphImages
110-
: undefined;
112+
: [];
111113

112114
let structuredImages = images;
113115
if ((typeof structured_data === 'object' && structured_data !== null)
@@ -119,7 +121,7 @@ module.exports = class extends Component {
119121

120122
const structuredImagesProp = (Array.isArray(structuredImages) && structuredImages.length) || typeof structuredImages === 'string'
121123
? structuredImages
122-
: undefined;
124+
: [];
123125

124126
let followItVerificationCode = null;
125127
if (Array.isArray(config.widgets)) {

0 commit comments

Comments
 (0)