How to resolve relationship in Gridsome

Hello there,

I’m trying to resolve relationships between stories in gridsome.
How can I have more than this in my response ? I would like to have the full object.
I check this page https://www.storyblok.com/docs/api/content-delivery#core-resources/stories/retrieve-one-story, but I can’t figure out how (or/and where) to achieve this.

Thank for your lights !

{
"_uid": "8f0ac55c-90a1-...",
"component": "customBlocks",
"reference": "53e164e3-57ff-4e82-881d-f09edef50c9b",
"_editable": "<!--#storyblok#{\"name\": \"customBlocks\", \"space\": \"84638\", \"uid\": \"8f0ac55c-90a1-40c5-97b3-440e231e5ac4\", \"id\": \"12002832\"}-->"
}

Hello Denis,

nice to have you in our forum!
You can take a look at our GraphQL playground http://gapi-browser.storyblok.com/?token=your_draft_token for being able to test queries in with your own spaces.

The query would utilize the parameter resolve_relations in this way:

{
  PageItem(resolve_relations: "component_name.field_name,component_name2.field.name2")
}

Hello Hannes,

Thank you. It works now.
I finally add the following parameter in gridsome.config.js plugin section :

types: {
      story: {
        typeName: 'StoryblokEntry',
        params: {
          // Automatically load customblocks
          resolve_relations: 'customBlockReference.reference'
        }
      }
    },
1 Like