Skip to content

Commit 839e625

Browse files
committed
Correctly handle default image for fullWidth
1 parent 39f5d02 commit 839e625

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/gatsby-plugin-sharp/src/image-data.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function generateImageData({
8686
}: IImageDataArgs): Promise<IGatsbyImageData | undefined> {
8787
const {
8888
layout = `constrained`,
89-
placeholder = `blurred`,
89+
placeholder = `dominantColor`,
9090
tracedSVGOptions = {},
9191
transformOptions = {},
9292
quality,
@@ -210,9 +210,10 @@ export async function generateImageData({
210210

211211
const sizes = args.sizes || getSizes(imageSizes.unscaledWidth, layout)
212212

213-
const primaryIndex = imageSizes.sizes.findIndex(
214-
size => size === imageSizes.unscaledWidth
215-
)
213+
const primaryIndex =
214+
layout === `fullWidth`
215+
? imageSizes.sizes.length - 1 // The largest image
216+
: imageSizes.sizes.findIndex(size => size === imageSizes.unscaledWidth)
216217

217218
if (primaryIndex === -1) {
218219
reporter.error(

0 commit comments

Comments
 (0)