Inconsistent results with useGatsbyImage
jacobarriola opened this issue · 3 comments
I've recently set the options.html.useGatsbyImage
setting to true
and am noticing that not all images get transformed from an <img>
element to a gatsby image.
- Posts - most images on posts get converted, although there are a few that do not
- Custom post type (kb) - no images are getting converted
So far, I can't seem to pick up a pattern, so I'm trying to figure out what the issue is.
Working (most blog posts):
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/password-security/
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/dedicated-server-hosting-or-cloud-hosting/
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/litespeed-vs-apache/
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/vps-vs-wordpress-hosting/
Not working (all KB posts + some blog posts):
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/tony-coleman/
https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/blog/remote-work-security/
all kb posts (see https://build-a17e0808-f163-4818-b61c-6a5b27fb9065.gtsb.io/kb/how-to-demystify-the-dns-process/)
Environment
gatsby-source-wordpress-experimental: 5.0.2
WPGraphQL: 1.0.4
WPGatsby: 0.8.0
WordPress: 5.5.1
Gatsby: 2.29.1
gatsby-transformer-sharp: 2.9
gatsby-plugin-sharp: 2.11.1
gatsby-image: 2.8.0
This is caused by the regular expressions here, where the greedy .*
search causes everything between the first opening tag and the last closing tag to be removed from the nodeString
. Any <img>
tag(s) between multiple <pre>
or <code>
tags are ignored.
That sounds pretty likely @msmallwood-lw !
@jacobarriola are you able to share your cloud dashboard link for this site so I can pull it down and take a look?
Thanks!
This may be fixed in the latest version of the plugin as there was a similar-sounding regression that was recently fixed - if it's not fixed on latest please re-open this issue with a comment containing a link to a reproduction repo or Gatsby Cloud dashboard link so I can debug/fix.
Cheers 😄