contentful – GraphQL fragment on a collection?

I want to make a fragment on a collection, but am unable to do so. Currently I have a collection called, componentCollection, that I would like as a separate fragment.

`
  pageCollection {
    items {
      name
      contentCollection {
        hero {
          ... heroFrag
        }
        cards {
          ... cardsFrag
        }
     }
     ${HERO_FRAG}
     ${CARD_FRAG}
   }
  }
`

What I want to do is something like:

`
  fragment contentCollectionFragment on ContentCollection {
      hero {
        ... heroFrag
      }
      cards {
        ... cardsFrag
      }
     ${HERO_FRAG}
     ${CARD_FRAG}
  }
`

So I can reuse this ‘content collection’. But it is saying ContentCollection is not available. I can do this though See below ( I basically have to use page collection. why can’t I use the fragment directly on content collection?. Content collection is currently a field on my page that I can reference to various content/blocks I’ve made):

`
 fragment contentCollectionFragment on PageCollection {
 items {
contentcollection {
 items {
     hero {
       ... heroFrag
     }
     cards {
       ... cardsFrag
     }
    ${HERO_FRAG}
    ${CARD_FRAG}
 }
}
}
}
`

Read more here: Source link