1

To get image transform in GraphQL we use this

image {
   url @transform ([width: 300, immediately: true])
}

But how do I get two different image transforms (for responsive image) for this asset field?

1

Untested, but should work:


image {
   foo: url @transform ([width: 300, immediately: true])
   boo: url @transform ([width: 600, immediately: true])
}

You can rename fields by just adding a new field name (ex foo:) before it in graphQL. The field name should not be one the object already has as it would overwrite the original field in this case.

|improve this answer|||||
  • Perfect, thank you. – Mato Feb 19 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.