Skip to content

Gatsby + NetlifyCMS image src not correct and srcset not being used #12572

@JoshLong23

Description

@JoshLong23

Description

After gatsby develop and build, the src attribute of images in markdown files(coming from NetlifyCMS) tries to look at where the image has been saved in the repo - ../../../static/assets/image.jpg

This occurred after updating a number of packages:
"gatsby": "^2.1.31",
"gatsby-plugin-netlify": "^2.0.12",
"gatsby-plugin-netlify-cms": "^3.0.14",
"gatsby-plugin-sharp": "^2.0.28",
"gatsby-source-filesystem": "^2.0.24",
"gatsby-transformer-remark": "^2.3.2",
"gatsby-transformer-sharp": "^2.1.17",
"netlify-cms": "^2.6.1",

However, reverting the the previous versions did not resolve my issue.

The commit before updating to these packages works as expected, nothing else changed in between.

As of before updating packages when everything was working, images loaded as expected with all of the srcset attributes etc for responsive images.

Annoyingly, all of the different size versions of each image are being correctly created inside the public/static folder, but for reasons unknown to me these files are not being used at all!

Steps to reproduce

The repo is at https://github.com/JoshLong23/barebones-NetlifyCMS and can be found live at https://faithful-waffle-a4ff4a.netlify.com

Expected result

As above, images should load with the correct src path looking at the public/assets folder and with the correct srcset attributes.

Environment

System:
OS: Windows 7
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
gatsby: ^2.1.31 => 2.1.32
gatsby-plugin-netlify: ^2.0.12 => 2.0.12
gatsby-plugin-netlify-cms: ^3.0.14 => 3.0.14
gatsby-plugin-sharp: ^2.0.28 => 2.0.28
gatsby-remark-copy-linked-files: ^2.0.10 => 2.0.10
gatsby-remark-images: ^3.0.9 => 3.0.9
gatsby-remark-relative-images: ^0.2.2 => 0.2.2
gatsby-source-filesystem: ^2.0.24 => 2.0.25
gatsby-transformer-remark: ^2.3.2 => 2.3.3
gatsby-transformer-sharp: ^2.1.17 => 2.1.17

I've really tried to find out what's gone wrong here, but to no avail, any help you can offer would be hugely appreciated!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions