gatsbyjs/gatsby-source-wordpress-experimental

Feature request: Support custom uploads directories for inline html image urls

Closed this issue · 3 comments

I have everything wired and content is coming in just fine. The only problem is that inline images seem to be un-altered, basically just what comes out of WordPress

React code:

<div dangerouslySetInnerHTML={{ __html: page.content }}>

Output code (just the inline image part):

<div class="wp-block-image">
     <figure class="alignright size-large">
          <img loading="lazy" width="251" height="300" src="/app/uploads/2021/01/logo.png" alt="" class="wp-image-6157">
     </figure>
</div>

gatsby-config.js

...
{
     resolve: `gatsby-source-wordpress-experimental`,
     options: {
          url: process.env.GATSBY_WP_ENDPOINT,
          useAcf: true,
          develop: {
               nodeUpdateInterval: 10000,
               hardCacheMediaFiles: true,
          },
          html: {
               useGatsbyImage: true,
               imageQuality: 80,
               imageMaxWidth: 1400,
          },
     }
},
...

Hi @michaelpanik , the plugin determines which urls are WP images by looking for /wp-content/uploads in url's. I believe that's why it's not working for you.

@TylerBarnes Perfect! I thought this might have been the same issue. I'm using the Roots + Trellis system for my WP install, which moves some core WP structure around. I'm going to do my own digging, but can you think of any potential workarounds for now?

As far as I can tell there isn't a workaround - support would need to be added directly. This feature request would actually make it work https://portal.gatsbyjs.com/gatsby-cloud/p/gatsby-source-wordpress-allow-non-wp-hosted-images-in-html and that might be a good way to support this 🤔 otherwise we could add a plugin option.

I'm cleaning up this repo and moving all feature requests into our internal backlog so I'm going to close this (but that doesn't mean we'll never support this). If you (or anyone else reading this) feels strongly about this feature you can add another feature request at https://portal.gatsbyjs.com/gatsby-cloud or upvote the request above ☝️

Thanks :)