DEV Community

Discussion on: Gatsby with WPGraphQL, ACF and Gatbsy-Image

Collapse
 
jacobarriola profile image
Jacob Arriola

This is great. Thank you - working as expected!

I wonder how I can bring in author avatars in the same manner as well (instead of just 3rd-party calls to gravatar's servers at run time)?

Collapse
 
henrikwirth profile image
Henrik Wirth • Edited

I just tried this:

createResolvers({
    WPGraphQL_Avatar: {
      imageFile: {
        type: "File",
        resolve(source) {
          return createRemoteFileNode({
            url: source.url,
            store,
            cache,
            createNode,
            createNodeId,
            reporter,
          })
        },
      },
    },
  })

Seems to work for me. Obviously it will fetch gravatars at build time. Maybe another Avatar solution would be possible, if you want to avoid using Gravatars.