쿼리 라이브러리
쿼리 라이브러리게시물의 모든 이미지 블록에서 URL 표시

게시물의 모든 이미지 블록에서 URL 표시

이 쿼리는 게시물 내 모든 블록(내부 블록 포함)의 데이터를 가져와 core/image 유형으로 필터링하고, 각 블록에서 URL 속성을 추출합니다.

query GetImageBlockImageURLs($postId: ID!) {
  post(by: { id: $postId }, status: any) {
    coreImageURLs: blockFlattenedDataItems(
      filterBy: { include: "core/image" }
    )
      @underEachArrayItem(
        passValueOnwardsAs: "blockDataItem"
      )
        @applyField(
          name: "_objectProperty"
          arguments: {
            object: $blockDataItem,
            by: {
              path: "attributes.url"
            }
          }
          setResultInResponse: true
        )
      @arrayUnique
  }
}